fix(appconfig): keep the tags of configuration profiles and deployment strategies (#9815)

This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-30 06:44:06 -04:00
1 parent 251a055cd1
commit deda9f32a6
8 files changed
+255 -24

No files matched your search

@@ -342,17 +342,63 @@ class AppConfigTest {
.deploymentDurationInMinutes(0)
.growthFactor(100f)
.finalBakeTimeInMinutes(0)
.tags(Map.of("owner", "Alice"))
.build()).id();
String arn = "arn:aws:appconfig:us-east-1:000000000000:deploymentstrategy/" + tagStrategyId;
try {
assertTagRoundTrip(arn);
} finally {
try {
appConfig.deleteDeploymentStrategy(DeleteDeploymentStrategyRequest.builder()
.deploymentStrategyId(tagStrategyId).build());
} catch (Exception ignored) {
// Best-effort cleanup: a failed delete must not hide the assertion that failed above it.
}
}
}
@Test
@Order(60)
@DisplayName("TagResource / ListTagsForResource / UntagResource - configuration profile, create-time Tags kept")
void tagConfigurationProfileViaSdk() {
String tagAppId = appConfig.createApplication(CreateApplicationRequest.builder()
.name("tag-roundtrip-profile-app")
.build()).id();
try {
String profileId = appConfig.createConfigurationProfile(CreateConfigurationProfileRequest.builder()
.applicationId(tagAppId)
.name("tag-roundtrip-profile")
.locationUri("hosted")
.tags(Map.of("owner", "Alice"))
.build()).id();
assertTagRoundTrip("arn:aws:appconfig:us-east-1:000000000000:application/" + tagAppId
+ "/configurationprofile/" + profileId);
appConfig.deleteConfigurationProfile(DeleteConfigurationProfileRequest.builder()
.applicationId(tagAppId).configurationProfileId(profileId).build());
} finally {
try {
appConfig.deleteApplication(DeleteApplicationRequest.builder()
.applicationId(tagAppId).build());
} catch (Exception ignored) {
// Best-effort cleanup: a failed delete must not hide the assertion that failed above it.
}
}
}
/** The resource {@code arn} names was created with owner=Alice: a tag is added, then one removed. */
private void assertTagRoundTrip(String arn) {
assertThat(appConfig.listTagsForResource(ListTagsForResourceRequest.builder().resourceArn(arn).build()).tags())
.containsExactlyEntriesOf(Map.of("owner", "Alice"));
appConfig.tagResource(TagResourceRequest.builder()
.resourceArn(arn)
.tags(Map.of("env", "prod"))
.build());
ListTagsForResourceResponse listed = appConfig.listTagsForResource(
ListTagsForResourceRequest.builder().resourceArn(arn).build());
assertThat(listed.tags()).isNotNull();
appConfig.untagResource(UntagResourceRequest.builder()
.resourceArn(arn)
.tagKeys("owner")
.build());
assertThat(appConfig.listTagsForResource(ListTagsForResourceRequest.builder().resourceArn(arn).build()).tags())
.containsExactlyEntriesOf(Map.of("env", "prod"));
}
@Test