@@ -138,7 +138,7 @@ func TestAccCognitoIDPManagedLoginBranding_settings(t *testing.T) {
138
138
CheckDestroy : testAccCheckManagedLoginBrandingDestroy (ctx ),
139
139
Steps : []resource.TestStep {
140
140
{
141
- Config : testAccManagedLoginBrandingConfig_settings (rName ),
141
+ Config : testAccManagedLoginBrandingConfig_settings (rName , "LIGHT" ),
142
142
Check : resource .ComposeAggregateTestCheckFunc (
143
143
testAccCheckManagedLoginBrandingExists (ctx , resourceName , & v ),
144
144
),
@@ -191,7 +191,7 @@ func TestAccCognitoIDPManagedLoginBranding_updateFromBasic(t *testing.T) {
191
191
},
192
192
},
193
193
{
194
- Config : testAccManagedLoginBrandingConfig_settings (rName ),
194
+ Config : testAccManagedLoginBrandingConfig_settings (rName , "LIGHT" ),
195
195
Check : resource .ComposeAggregateTestCheckFunc (
196
196
testAccCheckManagedLoginBrandingExists (ctx , resourceName , & v ),
197
197
),
@@ -222,7 +222,7 @@ func TestAccCognitoIDPManagedLoginBranding_updateToBasic(t *testing.T) {
222
222
CheckDestroy : testAccCheckManagedLoginBrandingDestroy (ctx ),
223
223
Steps : []resource.TestStep {
224
224
{
225
- Config : testAccManagedLoginBrandingConfig_settings (rName ),
225
+ Config : testAccManagedLoginBrandingConfig_settings (rName , "LIGHT" ),
226
226
Check : resource .ComposeAggregateTestCheckFunc (
227
227
testAccCheckManagedLoginBrandingExists (ctx , resourceName , & v ),
228
228
),
@@ -255,6 +255,52 @@ func TestAccCognitoIDPManagedLoginBranding_updateToBasic(t *testing.T) {
255
255
})
256
256
}
257
257
258
+ func TestAccCognitoIDPManagedLoginBranding_updateSettings (t * testing.T ) {
259
+ ctx := acctest .Context (t )
260
+ var v awstypes.ManagedLoginBrandingType
261
+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
262
+ resourceName := "aws_cognito_managed_login_branding.test"
263
+
264
+ resource .ParallelTest (t , resource.TestCase {
265
+ PreCheck : func () { acctest .PreCheck (ctx , t ); testAccPreCheckIdentityProvider (ctx , t ) },
266
+ ErrorCheck : acctest .ErrorCheck (t , names .CognitoIDPServiceID ),
267
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
268
+ CheckDestroy : testAccCheckManagedLoginBrandingDestroy (ctx ),
269
+ Steps : []resource.TestStep {
270
+ {
271
+ Config : testAccManagedLoginBrandingConfig_settings (rName , "LIGHT" ),
272
+ Check : resource .ComposeAggregateTestCheckFunc (
273
+ testAccCheckManagedLoginBrandingExists (ctx , resourceName , & v ),
274
+ ),
275
+ ConfigPlanChecks : resource.ConfigPlanChecks {
276
+ PreApply : []plancheck.PlanCheck {
277
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionCreate ),
278
+ },
279
+ },
280
+ ConfigStateChecks : []statecheck.StateCheck {
281
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("settings" ), knownvalue .NotNull ()),
282
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("use_cognito_provided_values" ), knownvalue .Bool (false )),
283
+ },
284
+ },
285
+ {
286
+ Config : testAccManagedLoginBrandingConfig_settings (rName , "DARK" ),
287
+ Check : resource .ComposeAggregateTestCheckFunc (
288
+ testAccCheckManagedLoginBrandingExists (ctx , resourceName , & v ),
289
+ ),
290
+ ConfigPlanChecks : resource.ConfigPlanChecks {
291
+ PreApply : []plancheck.PlanCheck {
292
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionUpdate ),
293
+ },
294
+ },
295
+ ConfigStateChecks : []statecheck.StateCheck {
296
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("settings" ), knownvalue .NotNull ()),
297
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("use_cognito_provided_values" ), knownvalue .Bool (false )),
298
+ },
299
+ },
300
+ },
301
+ })
302
+ }
303
+
258
304
func testAccCheckManagedLoginBrandingDestroy (ctx context.Context ) resource.TestCheckFunc {
259
305
return func (s * terraform.State ) error {
260
306
conn := acctest .Provider .Meta ().(* conns.AWSClient ).CognitoIDPClient (ctx )
@@ -345,8 +391,8 @@ resource "aws_cognito_managed_login_branding" "test" {
345
391
` )
346
392
}
347
393
348
- func testAccManagedLoginBrandingConfig_settings (rName string ) string {
349
- return acctest .ConfigCompose (testAccManagedLoginBrandingConfig_base (rName ), `
394
+ func testAccManagedLoginBrandingConfig_settings (rName , colorScheme string ) string {
395
+ return acctest .ConfigCompose (testAccManagedLoginBrandingConfig_base (rName ), fmt . Sprintf ( `
350
396
resource "aws_cognito_managed_login_branding" "test" {
351
397
client_id = aws_cognito_user_pool_client.test.id
352
398
user_pool_id = aws_cognito_user_pool.test.id
@@ -387,7 +433,7 @@ resource "aws_cognito_managed_login_branding" "test" {
387
433
"sessionTimerDisplay" : "NONE"
388
434
},
389
435
"global" : {
390
- "colorSchemeMode" : "LIGHT" ,
436
+ "colorSchemeMode" : %[1]q ,
391
437
"pageFooter" : {
392
438
"enabled" : false
393
439
},
@@ -804,5 +850,5 @@ resource "aws_cognito_managed_login_branding" "test" {
804
850
}
805
851
})
806
852
}
807
- ` )
853
+ ` , colorScheme ) )
808
854
}
0 commit comments