fix(sns): TagResource and UntagResource return their Result element (#6411)

The AWS SDKs decode both responses through TagResourceResult and
UntagResourceResult, so Terraform's aws_sns_topic tag updates now succeed.
This commit is contained in:
lex00 authored and GitHub committed 2026-10-24 08:30:04 -04:00
1 parent 6256805c33
commit 3b4589645b
2 files changed
+29 -2

No files matched your search

@@ -587,7 +587,7 @@ public class SnsQueryHandler {
Map<String, String> tags = extractSnsTags(params);
try {
snsService.tagResource(resourceArn, tags, region);
return Response.ok(AwsQueryResponse.envelopeNoResult("TagResource", AwsNamespaces.SNS)).build();
return Response.ok(AwsQueryResponse.envelopeEmptyResult("TagResource", AwsNamespaces.SNS)).build();
} catch (AwsException e) {
return xmlErrorResponse(e);
}
@@ -603,7 +603,7 @@ public class SnsQueryHandler {
}
try {
snsService.untagResource(resourceArn, tagKeys, region);
return Response.ok(AwsQueryResponse.envelopeNoResult("UntagResource", AwsNamespaces.SNS)).build();
return Response.ok(AwsQueryResponse.envelopeEmptyResult("UntagResource", AwsNamespaces.SNS)).build();
} catch (AwsException e) {
return xmlErrorResponse(e);
}
@@ -354,8 +354,35 @@ class SnsIntegrationTest {
.formParam("Tags.member.1.Value", "test")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<TagResourceResult"));
}
@Test
@Order(11)
void untagResource() {
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "TagResource")
.formParam("ResourceArn", topicArn)
.formParam("Tags.member.1.Key", "short-lived")
.formParam("Tags.member.1.Value", "yes")
.when()
.post("/")
.then()
.statusCode(200);
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "UntagResource")
.formParam("ResourceArn", topicArn)
.formParam("TagKeys.member.1", "short-lived")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<UntagResourceResult"));
}
@Test