Debian Codegraph @

tfconfig/schema.go

raw
1 // Copyright (c) HashiCorp, Inc.
2 // SPDX-License-Identifier: MPL-2.0
3
4 package tfconfig
5
6 import (
7 "github.com/hashicorp/hcl/v2"
8 )
9
10 var rootSchema = &hcl.BodySchema{
11 Blocks: []hcl.BlockHeaderSchema{
12 {
13 Type: "terraform",
14 LabelNames: nil,
15 },
16 {
17 Type: "variable",
18 LabelNames: []string{"name"},
19 },
20 {
21 Type: "output",
22 LabelNames: []string{"name"},
23 },
24 {
25 Type: "provider",
26 LabelNames: []string{"name"},
27 },
28 {
29 Type: "resource",
30 LabelNames: []string{"type", "name"},
31 },
32 {
33 Type: "data",
34 LabelNames: []string{"type", "name"},
35 },
36 {
37 Type: "module",
38 LabelNames: []string{"name"},
39 },
40 },
41 }
42
43 var terraformBlockSchema = &hcl.BodySchema{
44 Attributes: []hcl.AttributeSchema{
45 {
46 Name: "required_version",
47 },
48 },
49 Blocks: []hcl.BlockHeaderSchema{
50 {
51 Type: "required_providers",
52 },
53 },
54 }
55
56 var providerConfigSchema = &hcl.BodySchema{
57 Attributes: []hcl.AttributeSchema{
58 {
59 Name: "version",
60 },
61 {
62 Name: "alias",
63 },
64 },
65 }
66
67 var variableSchema = &hcl.BodySchema{
68 Attributes: []hcl.AttributeSchema{
69 {
70 Name: "type",
71 },
72 {
73 Name: "description",
74 },
75 {
76 Name: "default",
77 },
78 {
79 Name: "sensitive",
80 },
81 },
82 }
83
84 var outputSchema = &hcl.BodySchema{
85 Attributes: []hcl.AttributeSchema{
86 {
87 Name: "description",
88 },
89 {
90 Name: "sensitive",
91 },
92 },
93 }
94
95 var moduleCallSchema = &hcl.BodySchema{
96 Attributes: []hcl.AttributeSchema{
97 {
98 Name: "source",
99 },
100 {
101 Name: "version",
102 },
103 {
104 Name: "providers",
105 },
106 },
107 }
108
109 var resourceSchema = &hcl.BodySchema{
110 Attributes: []hcl.AttributeSchema{
111 {
112 Name: "provider",
113 },
114 },
115 }