fix(cloudwatch): wrap TagResource and UntagResource in their declared Result element (#3211)

TagResourceOutput and UntagResourceOutput are empty structures with a
declared resultWrapper, so the Query responses must carry the
TagResourceResult and UntagResourceResult elements. The AWS Go SDK v2
unmarshaler behind the Terraform AWS provider fails on a response
without them even though the tag write succeeded.

Ported from lex00/floci#89.
This commit is contained in:
lex00 authored and GitHub committed 2026-09-07 22:11:12 -04:00
1 parent 991470e7c4
commit 65db87d627
3 files changed
+143 -2

No files matched your search

@@ -285,7 +285,10 @@ public class CloudWatchMetricsQueryHandler {
} else {
metricsService.tagResource(arn, tags, region);
}
return Response.ok(AwsQueryResponse.envelopeNoResult("TagResource", null)).build();
// TagResourceOutput is an empty structure with a declared resultWrapper, so the
// wrapper element must be present. The AWS Go SDK v2 unmarshaler, behind the
// Terraform AWS provider, fails on a response without it.
return Response.ok(AwsQueryResponse.envelopeEmptyResult("TagResource", null)).build();
}
private Response handleUntagResource(MultivaluedMap<String, String> params, String region) {
@@ -301,7 +304,7 @@ public class CloudWatchMetricsQueryHandler {
} else {
metricsService.untagResource(arn, keys, region);
}
return Response.ok(AwsQueryResponse.envelopeNoResult("UntagResource", null)).build();
return Response.ok(AwsQueryResponse.envelopeEmptyResult("UntagResource", null)).build();
}
// ──────────────────────────── Dashboards ────────────────────────────