Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_route53profiles_profile: fix inconsistent result on tags update #39613

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions internal/service/route53profiles/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,29 @@ func (r *resourceProfile) Schema(ctx context.Context, req resource.SchemaRequest
},
names.AttrOwnerID: schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"share_status": schema.StringAttribute{
CustomType: fwtypes.StringEnumType[awstypes.ShareStatus](),
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
names.AttrStatus: schema.StringAttribute{
CustomType: fwtypes.StringEnumType[awstypes.ProfileStatus](),
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
names.AttrStatusMessage: schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
names.AttrTags: tftags.TagsAttribute(),
names.AttrTagsAll: tftags.TagsAttributeComputedOnly(),
Expand Down
32 changes: 31 additions & 1 deletion internal/service/route53profiles/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@ func TestAccRoute53ProfilesProfile_tags(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccProfileConfig_tags2(rName, acctest.CtKey1, acctest.CtValue1Updated, acctest.CtKey2, acctest.CtValue2),
Check: resource.ComposeTestCheckFunc(
testAccCheckProfileExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct2),
resource.TestCheckResourceAttr(resourceName, acctest.CtTagsKey1, acctest.CtValue1Updated),
resource.TestCheckResourceAttr(resourceName, acctest.CtTagsKey2, acctest.CtValue2),
),
},
{
Config: testAccProfileConfig_tags1(rName, acctest.CtKey2, acctest.CtValue2),
Check: resource.ComposeTestCheckFunc(
testAccCheckProfileExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, acctest.Ct1),
resource.TestCheckResourceAttr(resourceName, acctest.CtTagsKey2, acctest.CtValue2),
),
},
},
})
}
Expand Down Expand Up @@ -164,7 +181,7 @@ resource "aws_route53profiles_profile" "test" {
`, rName)
}

func testAccProfileConfig_tags1(rName string, tagKey1 string, tagValue1 string) string {
func testAccProfileConfig_tags1(rName, tagKey1, tagValue1 string) string {
return fmt.Sprintf(`
resource "aws_route53profiles_profile" "test" {
name = %[1]q
Expand All @@ -175,3 +192,16 @@ resource "aws_route53profiles_profile" "test" {
}
`, rName, tagKey1, tagValue1)
}

func testAccProfileConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
return fmt.Sprintf(`
resource "aws_route53profiles_profile" "test" {
name = %[1]q

tags = {
%[2]q = %[3]q
%[4]q = %[5]q
}
}
`, rName, tagKey1, tagValue1, tagKey2, tagValue2)
}
Loading