@@ -13,84 +13,17 @@ var v1_2 = version.Must(version.NewVersion("1.2.0"))
13
13
14
14
func ModuleSchema (v * version.Version ) * schema.BodySchema {
15
15
bs := v1_1_mod .ModuleSchema (v )
16
- if v .GreaterThanOrEqual (v1_2 ) {
17
- bs .Blocks ["data" ].Body .Blocks = map [string ]* schema.BlockSchema {
18
- "lifecycle" : datasourceLifecycleBlock ,
19
- }
20
- bs .Blocks ["resource" ].Body .Blocks ["lifecycle" ] = resourceLifecycleBlock
21
- bs .Blocks ["output" ].Body .Blocks = map [string ]* schema.BlockSchema {
22
- "lifecycle" : outputLifecycleBlock ,
23
- }
16
+ bs .Blocks ["data" ].Body .Blocks = map [string ]* schema.BlockSchema {
17
+ "lifecycle" : datasourceLifecycleBlock ,
18
+ }
19
+ bs .Blocks ["resource" ].Body .Blocks ["lifecycle" ] = resourceLifecycleBlock
20
+ bs .Blocks ["output" ].Body .Blocks = map [string ]* schema.BlockSchema {
21
+ "lifecycle" : outputLifecycleBlock ,
24
22
}
25
23
26
24
return bs
27
25
}
28
26
29
- var datasourceLifecycleBlock = & schema.BlockSchema {
30
- Description : lang .Markdown ("Lifecycle customizations to set validity conditions of the datasource" ),
31
- Body : & schema.BodySchema {
32
- Blocks : map [string ]* schema.BlockSchema {
33
- "precondition" : {
34
- Body : conditionBody ,
35
- },
36
- "postcondition" : {
37
- Body : conditionBody ,
38
- },
39
- },
40
- },
41
- }
42
-
43
- var outputLifecycleBlock = & schema.BlockSchema {
44
- Description : lang .Markdown ("Lifecycle customizations, to set a validity condition of the output" ),
45
- Body : & schema.BodySchema {
46
- Blocks : map [string ]* schema.BlockSchema {
47
- "precondition" : {
48
- Body : conditionBody ,
49
- },
50
- },
51
- },
52
- }
53
-
54
- var resourceLifecycleBlock = & schema.BlockSchema {
55
- Description : lang .Markdown ("Lifecycle customizations to change default resource behaviours during plan or apply" ),
56
- Body : & schema.BodySchema {
57
- Attributes : map [string ]* schema.AttributeSchema {
58
- "create_before_destroy" : {
59
- Expr : schema .LiteralTypeOnly (cty .Bool ),
60
- IsOptional : true ,
61
- Description : lang .Markdown ("Whether to reverse the default order of operations (destroy -> create) during apply " +
62
- "when the resource requires replacement (cannot be updated in-place)" ),
63
- },
64
- "prevent_destroy" : {
65
- Expr : schema .LiteralTypeOnly (cty .Bool ),
66
- IsOptional : true ,
67
- Description : lang .Markdown ("Whether to prevent accidental destruction of the resource and cause Terraform " +
68
- "to reject with an error any plan that would destroy the resource" ),
69
- },
70
- "ignore_changes" : {
71
- Expr : schema.ExprConstraints {
72
- schema.TupleConsExpr {},
73
- schema.KeywordExpr {
74
- Keyword : "all" ,
75
- Description : lang .Markdown ("Ignore all attributes, which means that Terraform can create" +
76
- " and destroy the remote object but will never propose updates to it" ),
77
- },
78
- },
79
- IsOptional : true ,
80
- Description : lang .Markdown ("A set of fields (references) of which to ignore changes to, e.g. `tags`" ),
81
- },
82
- },
83
- Blocks : map [string ]* schema.BlockSchema {
84
- "precondition" : {
85
- Body : conditionBody ,
86
- },
87
- "postcondition" : {
88
- Body : conditionBody ,
89
- },
90
- },
91
- },
92
- }
93
-
94
27
var conditionBody = & schema.BodySchema {
95
28
Attributes : map [string ]* schema.AttributeSchema {
96
29
"condition" : {
0 commit comments