@@ -23,13 +23,13 @@ func connectionBlock(v *version.Version) *schema.BlockSchema {
23
23
HoverURL : "https://www.terraform.io/docs/language/resources/provisioners/connection.html" ,
24
24
Attributes : map [string ]* schema.AttributeSchema {
25
25
"type" : {
26
- Expr : schema.ExprConstraints {
27
- schema.LegacyLiteralValue {
28
- Val : cty .StringVal ("ssh" ),
26
+ Constraint : schema.OneOf {
27
+ schema.LiteralValue {
28
+ Value : cty .StringVal ("ssh" ),
29
29
Description : lang .Markdown ("Use SSH to connect and provision the instance" ),
30
30
},
31
- schema.LegacyLiteralValue {
32
- Val : cty .StringVal ("winrm" ),
31
+ schema.LiteralValue {
32
+ Value : cty .StringVal ("winrm" ),
33
33
Description : lang .Markdown ("Use WinRM to connect and provision the instance" ),
34
34
},
35
35
},
@@ -39,56 +39,38 @@ func connectionBlock(v *version.Version) *schema.BlockSchema {
39
39
Description : lang .Markdown ("Connection type to use - `ssh` (default) or `winrm`" ),
40
40
},
41
41
"user" : {
42
- Expr : schema.ExprConstraints {
43
- schema.TraversalExpr {OfType : cty .String },
44
- schema.LiteralTypeExpr {Type : cty .String },
45
- },
42
+ Constraint : schema.AnyExpression {OfType : cty .String },
46
43
IsOptional : true ,
47
44
Description : lang .Markdown ("The user that we should use for the connection. " +
48
45
"Defaults to `root` when using type `ssh` and defaults to `Administrator` " +
49
46
"when using type `winrm`." ),
50
47
},
51
48
"password" : {
52
- Expr : schema.ExprConstraints {
53
- schema.TraversalExpr {OfType : cty .String },
54
- schema.LiteralTypeExpr {Type : cty .String },
55
- },
49
+ Constraint : schema.AnyExpression {OfType : cty .String },
56
50
IsOptional : true ,
57
51
Description : lang .Markdown ("The password we should use for the connection. " +
58
52
"In some cases this is specified by the provider." ),
59
53
},
60
54
"host" : {
61
- Expr : schema.ExprConstraints {
62
- schema.TraversalExpr {OfType : cty .String },
63
- schema.LiteralTypeExpr {Type : cty .String },
64
- },
55
+ Constraint : schema.AnyExpression {OfType : cty .String },
65
56
IsRequired : true ,
66
57
Description : lang .Markdown ("The address of the resource to connect to" ),
67
58
},
68
59
"port" : {
69
- Expr : schema.ExprConstraints {
70
- schema.TraversalExpr {OfType : cty .String },
71
- schema.LiteralTypeExpr {Type : cty .String },
72
- },
60
+ Constraint : schema.AnyExpression {OfType : cty .String },
73
61
IsOptional : true ,
74
62
Description : lang .Markdown ("The port to connect to. Defaults to `22` " +
75
63
"when using type `ssh` and defaults to `5985` when using type `winrm`." ),
76
64
},
77
65
"timeout" : {
78
- Expr : schema.ExprConstraints {
79
- schema.TraversalExpr {OfType : cty .String },
80
- schema.LiteralTypeExpr {Type : cty .String },
81
- },
66
+ Constraint : schema.AnyExpression {OfType : cty .String },
82
67
IsOptional : true ,
83
68
Description : lang .Markdown ("The timeout to wait for the connection to become " +
84
69
"available. Should be provided as a string like `30s` or `5m`. " +
85
70
"Defaults to 5 minutes." ),
86
71
},
87
72
"script_path" : {
88
- Expr : schema.ExprConstraints {
89
- schema.TraversalExpr {OfType : cty .String },
90
- schema.LiteralTypeExpr {Type : cty .String },
91
- },
73
+ Constraint : schema.AnyExpression {OfType : cty .String },
92
74
IsOptional : true ,
93
75
Description : lang .Markdown ("The path used to copy scripts meant for remote execution." ),
94
76
},
@@ -113,99 +95,66 @@ func ConnectionDependentBodies(v *version.Version) map[schema.SchemaKey]*schema.
113
95
m [ssh ] = & schema.BodySchema {
114
96
Attributes : map [string ]* schema.AttributeSchema {
115
97
"private_key" : {
116
- Expr : schema.ExprConstraints {
117
- schema.TraversalExpr {OfType : cty .String },
118
- schema.LiteralTypeExpr {Type : cty .String },
119
- },
98
+ Constraint : schema.AnyExpression {OfType : cty .String },
120
99
IsOptional : true ,
121
100
Description : lang .Markdown ("The contents of an SSH key to use for the connection. " +
122
101
"This takes preference over the password if provided." ),
123
102
},
124
103
"certificate" : {
125
- Expr : schema.ExprConstraints {
126
- schema.TraversalExpr {OfType : cty .String },
127
- schema.LiteralTypeExpr {Type : cty .String },
128
- },
104
+ Constraint : schema.AnyExpression {OfType : cty .String },
129
105
IsOptional : true ,
130
106
Description : lang .Markdown ("The contents of a signed CA Certificate. The argument " +
131
107
"must be used in conjunction with a `private_key`." ),
132
108
},
133
109
"agent" : {
134
- Expr : schema.ExprConstraints {
135
- schema.TraversalExpr {OfType : cty .Bool },
136
- schema.LiteralTypeExpr {Type : cty .Bool },
137
- },
110
+ Constraint : schema.AnyExpression {OfType : cty .Bool },
138
111
IsOptional : true ,
139
112
Description : lang .Markdown ("Set to `false` to disable using `ssh-agent` to authenticate. " +
140
113
"On Windows the only supported SSH authentication agent is " +
141
114
"[Pageant](http://the.earth.li/~sgtatham/putty/0.66/htmldoc/Chapter9.html#pageant)." ),
142
115
},
143
116
"agent_identity" : {
144
- Expr : schema.ExprConstraints {
145
- schema.TraversalExpr {OfType : cty .String },
146
- schema.LiteralTypeExpr {Type : cty .String },
147
- },
117
+ Constraint : schema.AnyExpression {OfType : cty .String },
148
118
IsOptional : true ,
149
119
Description : lang .Markdown ("The preferred identity from the ssh agent for authentication." ),
150
120
},
151
121
"host_key" : {
152
- Expr : schema.ExprConstraints {
153
- schema.TraversalExpr {OfType : cty .String },
154
- schema.LiteralTypeExpr {Type : cty .String },
155
- },
122
+ Constraint : schema.AnyExpression {OfType : cty .String },
156
123
IsOptional : true ,
157
124
Description : lang .Markdown ("The public key from the remote host or the signing CA, used to verify the connection." ),
158
125
},
159
126
"bastion_host" : {
160
- Expr : schema.ExprConstraints {
161
- schema.TraversalExpr {OfType : cty .String },
162
- schema.LiteralTypeExpr {Type : cty .String },
163
- },
127
+ Constraint : schema.AnyExpression {OfType : cty .String },
164
128
IsOptional : true ,
165
129
Description : lang .Markdown ("Setting this enables the bastion host connection. " +
166
130
"This host will be connected to first, and then the `host` connection will be made from there." ),
167
131
},
168
132
"bastion_host_key" : {
169
- Expr : schema.ExprConstraints {
170
- schema.TraversalExpr {OfType : cty .String },
171
- schema.LiteralTypeExpr {Type : cty .String },
172
- },
133
+ Constraint : schema.AnyExpression {OfType : cty .String },
173
134
IsOptional : true ,
174
135
Description : lang .Markdown ("The public key from the remote host or the signing CA, " +
175
136
"used to verify the host connection." ),
176
137
},
177
138
"bastion_port" : {
178
- Expr : schema.ExprConstraints {
179
- schema.TraversalExpr {OfType : cty .Number },
180
- schema.LiteralTypeExpr {Type : cty .Number },
181
- },
139
+ Constraint : schema.AnyExpression {OfType : cty .Number },
182
140
IsOptional : true ,
183
141
Description : lang .Markdown ("The port to use connect to the bastion host. " +
184
142
"Defaults to the value of the `port` field." ),
185
143
},
186
144
"bastion_user" : {
187
- Expr : schema.ExprConstraints {
188
- schema.TraversalExpr {OfType : cty .String },
189
- schema.LiteralTypeExpr {Type : cty .String },
190
- },
145
+ Constraint : schema.AnyExpression {OfType : cty .String },
191
146
IsOptional : true ,
192
147
Description : lang .Markdown ("The user for the connection to the bastion host. " +
193
148
"Defaults to the value of the `user` field." ),
194
149
},
195
150
"bastion_password" : {
196
- Expr : schema.ExprConstraints {
197
- schema.TraversalExpr {OfType : cty .String },
198
- schema.LiteralTypeExpr {Type : cty .String },
199
- },
151
+ Constraint : schema.AnyExpression {OfType : cty .String },
200
152
IsOptional : true ,
201
153
Description : lang .Markdown ("The password we should use for the bastion host. " +
202
154
"Defaults to the value of the `password` field." ),
203
155
},
204
156
"bastion_private_key" : {
205
- Expr : schema.ExprConstraints {
206
- schema.TraversalExpr {OfType : cty .String },
207
- schema.LiteralTypeExpr {Type : cty .String },
208
- },
157
+ Constraint : schema.AnyExpression {OfType : cty .String },
209
158
IsOptional : true ,
210
159
Description : lang .Markdown ("The contents of an SSH key file to use for the bastion host. " +
211
160
"Defaults to the value of the `private_key` field." ),
@@ -216,10 +165,7 @@ func ConnectionDependentBodies(v *version.Version) map[schema.SchemaKey]*schema.
216
165
// See https://github.com/hashicorp/terraform/commit/3031aca9
217
166
if v .GreaterThanOrEqual (v0_12_7 ) {
218
167
m [ssh ].Attributes ["bastion_certificate" ] = & schema.AttributeSchema {
219
- Expr : schema.ExprConstraints {
220
- schema.TraversalExpr {OfType : cty .String },
221
- schema.LiteralTypeExpr {Type : cty .String },
222
- },
168
+ Constraint : schema.AnyExpression {OfType : cty .String },
223
169
IsOptional : true ,
224
170
Description : lang .Markdown ("The contents of a signed CA Certificate. The `certificate` argument " +
225
171
"must be used in conjunction with a `bastion_private_key`." ),
@@ -237,37 +183,25 @@ func ConnectionDependentBodies(v *version.Version) map[schema.SchemaKey]*schema.
237
183
m [winRm ] = & schema.BodySchema {
238
184
Attributes : map [string ]* schema.AttributeSchema {
239
185
"https" : {
240
- Expr : schema.ExprConstraints {
241
- schema.TraversalExpr {OfType : cty .Bool },
242
- schema.LiteralTypeExpr {Type : cty .Bool },
243
- },
186
+ Constraint : schema.AnyExpression {OfType : cty .Bool },
244
187
IsOptional : true ,
245
188
Description : lang .Markdown ("Set to `true` to connect using HTTPS instead of HTTP." ),
246
189
},
247
190
"insecure" : {
248
- Expr : schema.ExprConstraints {
249
- schema.TraversalExpr {OfType : cty .Bool },
250
- schema.LiteralTypeExpr {Type : cty .Bool },
251
- },
191
+ Constraint : schema.AnyExpression {OfType : cty .Bool },
252
192
IsOptional : true ,
253
193
Description : lang .Markdown ("Set to `true` to not validate the HTTPS certificate chain." ),
254
194
},
255
195
"use_ntlm" : {
256
- Expr : schema.ExprConstraints {
257
- schema.TraversalExpr {OfType : cty .Bool },
258
- schema.LiteralTypeExpr {Type : cty .Bool },
259
- },
196
+ Constraint : schema.AnyExpression {OfType : cty .Bool },
260
197
IsOptional : true ,
261
198
Description : lang .Markdown ("Set to `true` to use NTLM authentication, rather than default " +
262
199
"(basic authentication), removing the requirement for basic authentication to be enabled " +
263
200
"within the target guest. Read more about remote connection authentication at " +
264
201
"[docs.microsoft.com](https://docs.microsoft.com/en-gb/windows/win32/winrm/authentication-for-remote-connections)." ),
265
202
},
266
203
"cacert" : {
267
- Expr : schema.ExprConstraints {
268
- schema.TraversalExpr {OfType : cty .String },
269
- schema.LiteralTypeExpr {Type : cty .String },
270
- },
204
+ Constraint : schema.AnyExpression {OfType : cty .String },
271
205
IsOptional : true ,
272
206
Description : lang .Markdown ("The CA certificate to validate against." ),
273
207
},
0 commit comments