@@ -15,9 +15,14 @@ import (
15
15
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
16
16
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
17
17
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
18
+ "github.com/hashicorp/terraform-plugin-testing/knownvalue"
18
19
"github.com/hashicorp/terraform-plugin-testing/plancheck"
20
+ "github.com/hashicorp/terraform-plugin-testing/statecheck"
19
21
"github.com/hashicorp/terraform-plugin-testing/terraform"
22
+ "github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
20
23
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
24
+ tfknownvalue "github.com/hashicorp/terraform-provider-aws/internal/acctest/knownvalue"
25
+ tfstatecheck "github.com/hashicorp/terraform-provider-aws/internal/acctest/statecheck"
21
26
"github.com/hashicorp/terraform-provider-aws/internal/conns"
22
27
"github.com/hashicorp/terraform-provider-aws/internal/errs"
23
28
tfiam "github.com/hashicorp/terraform-provider-aws/internal/service/iam"
@@ -972,7 +977,7 @@ func TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemovedEmpty(t *testing.T) {
972
977
})
973
978
}
974
979
975
- func TestAccIAMRole_Identity_ExistingResource_NoRefresh (t * testing.T ) {
980
+ func TestAccIAMRole_Identity_ExistingResource_NoRefresh_WithChange (t * testing.T ) {
976
981
ctx := acctest .Context (t )
977
982
var conf awstypes.Role
978
983
rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
@@ -999,15 +1004,31 @@ func TestAccIAMRole_Identity_ExistingResource_NoRefresh(t *testing.T) {
999
1004
Check : resource .ComposeAggregateTestCheckFunc (
1000
1005
testAccCheckRoleExists (ctx , resourceName , & conf ),
1001
1006
),
1007
+ ConfigStateChecks : []statecheck.StateCheck {
1008
+ tfstatecheck .ExpectNoIdentity (resourceName ),
1009
+ },
1002
1010
},
1003
1011
{
1004
1012
ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
1005
1013
Config : testAccRoleConfig_description (rName ),
1006
1014
Check : resource .ComposeAggregateTestCheckFunc (
1007
1015
testAccCheckRoleExists (ctx , resourceName , & conf ),
1008
1016
),
1009
- // No error indicates the identity interceptor properly identified
1010
- // a fully null identity on update and set values appropriately.
1017
+ ConfigPlanChecks : resource.ConfigPlanChecks {
1018
+ PreApply : []plancheck.PlanCheck {
1019
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionUpdate ),
1020
+ },
1021
+ PostApplyPostRefresh : []plancheck.PlanCheck {
1022
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionNoop ),
1023
+ },
1024
+ },
1025
+ ConfigStateChecks : []statecheck.StateCheck {
1026
+ statecheck .ExpectIdentity (resourceName , map [string ]knownvalue.Check {
1027
+ names .AttrAccountID : tfknownvalue .AccountID (),
1028
+ names .AttrName : knownvalue .NotNull (),
1029
+ }),
1030
+ statecheck .ExpectIdentityValueMatchesState (resourceName , tfjsonpath .New (names .AttrName )),
1031
+ },
1011
1032
},
1012
1033
},
1013
1034
})
0 commit comments