@@ -43,6 +43,18 @@ func resourceDomainConfiguration() *schema.Resource {
43
43
Type : schema .TypeString ,
44
44
Computed : true ,
45
45
},
46
+ "application_protocol" : {
47
+ Type : schema .TypeString ,
48
+ Optional : true ,
49
+ Computed : true ,
50
+ ValidateDiagFunc : enum .Validate [awstypes.ApplicationProtocol ](),
51
+ },
52
+ "authentication_type" : {
53
+ Type : schema .TypeString ,
54
+ Optional : true ,
55
+ Computed : true ,
56
+ ValidateDiagFunc : enum .Validate [awstypes.AuthenticationType ](),
57
+ },
46
58
"authorizer_config" : {
47
59
Type : schema .TypeList ,
48
60
Optional : true ,
@@ -129,11 +141,19 @@ func resourceDomainConfigurationCreate(ctx context.Context, d *schema.ResourceDa
129
141
conn := meta .(* conns.AWSClient ).IoTClient (ctx )
130
142
131
143
name := d .Get (names .AttrName ).(string )
132
- input := & iot.CreateDomainConfigurationInput {
144
+ input := iot.CreateDomainConfigurationInput {
133
145
DomainConfigurationName : aws .String (name ),
134
146
Tags : getTagsIn (ctx ),
135
147
}
136
148
149
+ if v , ok := d .GetOk ("application_protocol" ); ok {
150
+ input .ApplicationProtocol = awstypes .ApplicationProtocol (v .(string ))
151
+ }
152
+
153
+ if v , ok := d .GetOk ("authentication_type" ); ok {
154
+ input .AuthenticationType = awstypes .AuthenticationType (v .(string ))
155
+ }
156
+
137
157
if v , ok := d .GetOk ("authorizer_config" ); ok && len (v .([]any )) > 0 && v .([]any )[0 ] != nil {
138
158
input .AuthorizerConfig = expandAuthorizerConfig (v .([]any )[0 ].(map [string ]any ))
139
159
}
@@ -158,7 +178,7 @@ func resourceDomainConfigurationCreate(ctx context.Context, d *schema.ResourceDa
158
178
input .ValidationCertificateArn = aws .String (v .(string ))
159
179
}
160
180
161
- output , err := conn .CreateDomainConfiguration (ctx , input )
181
+ output , err := conn .CreateDomainConfiguration (ctx , & input )
162
182
163
183
if err != nil {
164
184
return sdkdiag .AppendErrorf (diags , "creating IoT Domain Configuration (%s): %s" , name , err )
@@ -185,7 +205,9 @@ func resourceDomainConfigurationRead(ctx context.Context, d *schema.ResourceData
185
205
return sdkdiag .AppendErrorf (diags , "reading IoT Domain Configuration (%s): %s" , d .Id (), err )
186
206
}
187
207
208
+ d .Set ("application_protocol" , output .ApplicationProtocol )
188
209
d .Set (names .AttrARN , output .DomainConfigurationArn )
210
+ d .Set ("authentication_type" , output .AuthenticationType )
189
211
if output .AuthorizerConfig != nil {
190
212
if err := d .Set ("authorizer_config" , []any {flattenAuthorizerConfig (output .AuthorizerConfig )}); err != nil {
191
213
return sdkdiag .AppendErrorf (diags , "setting authorizer_config: %s" , err )
@@ -218,10 +240,18 @@ func resourceDomainConfigurationUpdate(ctx context.Context, d *schema.ResourceDa
218
240
conn := meta .(* conns.AWSClient ).IoTClient (ctx )
219
241
220
242
if d .HasChangesExcept (names .AttrTags , names .AttrTagsAll ) {
221
- input := & iot.UpdateDomainConfigurationInput {
243
+ input := iot.UpdateDomainConfigurationInput {
222
244
DomainConfigurationName : aws .String (d .Id ()),
223
245
}
224
246
247
+ if d .HasChange ("application_protocol" ) {
248
+ input .ApplicationProtocol = awstypes .ApplicationProtocol (d .Get ("application_protocol" ).(string ))
249
+ }
250
+
251
+ if d .HasChange ("authentication_type" ) {
252
+ input .AuthenticationType = awstypes .AuthenticationType (d .Get ("authentication_type" ).(string ))
253
+ }
254
+
225
255
if d .HasChange ("authorizer_config" ) {
226
256
if v , ok := d .GetOk ("authorizer_config" ); ok && len (v .([]any )) > 0 && v .([]any )[0 ] != nil {
227
257
input .AuthorizerConfig = expandAuthorizerConfig (v .([]any )[0 ].(map [string ]any ))
@@ -240,7 +270,7 @@ func resourceDomainConfigurationUpdate(ctx context.Context, d *schema.ResourceDa
240
270
}
241
271
}
242
272
243
- _ , err := conn .UpdateDomainConfiguration (ctx , input )
273
+ _ , err := conn .UpdateDomainConfiguration (ctx , & input )
244
274
245
275
if err != nil {
246
276
return sdkdiag .AppendErrorf (diags , "updating IoT Domain Configuration (%s): %s" , d .Id (), err )
@@ -255,10 +285,11 @@ func resourceDomainConfigurationDelete(ctx context.Context, d *schema.ResourceDa
255
285
conn := meta .(* conns.AWSClient ).IoTClient (ctx )
256
286
257
287
if d .Get (names .AttrStatus ).(string ) == string (awstypes .DomainConfigurationStatusEnabled ) {
258
- _ , err := conn . UpdateDomainConfiguration ( ctx , & iot.UpdateDomainConfigurationInput {
288
+ input := iot.UpdateDomainConfigurationInput {
259
289
DomainConfigurationName : aws .String (d .Id ()),
260
290
DomainConfigurationStatus : awstypes .DomainConfigurationStatusDisabled ,
261
- })
291
+ }
292
+ _ , err := conn .UpdateDomainConfiguration (ctx , & input )
262
293
263
294
if errs.IsA [* awstypes.ResourceNotFoundException ](err ) {
264
295
return diags
@@ -270,9 +301,10 @@ func resourceDomainConfigurationDelete(ctx context.Context, d *schema.ResourceDa
270
301
}
271
302
272
303
log .Printf ("[DEBUG] Deleting IoT Domain Configuration: %s" , d .Id ())
273
- _ , err := conn . DeleteDomainConfiguration ( ctx , & iot.DeleteDomainConfigurationInput {
304
+ input := iot.DeleteDomainConfigurationInput {
274
305
DomainConfigurationName : aws .String (d .Id ()),
275
- })
306
+ }
307
+ _ , err := conn .DeleteDomainConfiguration (ctx , & input )
276
308
277
309
if errs.IsA [* awstypes.ResourceNotFoundException ](err ) {
278
310
return diags
@@ -286,11 +318,11 @@ func resourceDomainConfigurationDelete(ctx context.Context, d *schema.ResourceDa
286
318
}
287
319
288
320
func findDomainConfigurationByName (ctx context.Context , conn * iot.Client , name string ) (* iot.DescribeDomainConfigurationOutput , error ) {
289
- input := & iot.DescribeDomainConfigurationInput {
321
+ input := iot.DescribeDomainConfigurationInput {
290
322
DomainConfigurationName : aws .String (name ),
291
323
}
292
324
293
- output , err := conn .DescribeDomainConfiguration (ctx , input )
325
+ output , err := conn .DescribeDomainConfiguration (ctx , & input )
294
326
295
327
if errs.IsA [* awstypes.ResourceNotFoundException ](err ) {
296
328
return nil , & retry.NotFoundError {
0 commit comments