aws-sdk-go-v2
aws-sdk-go-v2 copied to clipboard
[CloudFormation] Empty Array on UpdateStackInput Fails to Remove NotificationARNs
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [x] I've gone though the API reference
- [x] I've checked AWS Forums and StackOverflow for answers
- [x] I've searched for previous similar issues and didn't find any solution
Describe the bug
When attempting to remove NotificationARNs on UpdateStack according to the documentation (with an empty array), it appears the empty array gets filtered out of the API submission entirely somewhere down the call stack. The effect is NotificationARNs can't be completely removed on update.
https://github.com/aws/aws-sdk-go-v2/blob/service/cloudformation/v1.10.1/service/cloudformation/api_op_UpdateStack.go#L144-L147
Version of AWS SDK for Go?
require (
github.com/aws/aws-sdk-go-v2 v1.9.0
github.com/aws/aws-sdk-go-v2/config v1.8.0
github.com/aws/aws-sdk-go-v2/credentials v1.4.0
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.10.0
github.com/aws/aws-sdk-go-v2/service/sts v1.7.0
Version of Go (go version)?
1.17
To Reproduce (observed behavior)
- Using either the go SDK or another method, create a stack with a NotificationARN
- Using the goSDK attempt to submit a stack update (either with or without a template change) and set UpdateStackInput.NotificationARNs to an empty string array:
input.NotificationARNs = []string{}
Expected behavior
The NotificationARN to be removed from the CloudFormation stack
Additional context
I captured a trace both when it's submitting the entry and then when it appears to vanish even with an explicit empty string array included in the input. (Using the ClientLogMode LogRequestWithBody)
When it gets added:
Action=UpdateStack&NotificationARNs.member.1=arn%3Aaws%3Asns%3Aus-east-2%3A641875867446%3Aalert-steve&RoleARN=arn%3Aaws%3Aiam%3A%3A641875867446%3Arole%2Fcf-resources-allowed&StackName=my-queue&Tags.member.1.Key=kubernetes.io%2Fcontrolled-by&Tags.member.1.Value=cloudformation.cuppett.com%2Foperator&Tags.member.2.Key=kubernetes.io%2Fowned-by&Tags.member.2.Value=6f685593-2197-481c-ba15-1770743eceed&TemplateBody=---%0AAWSTemplateFormatVersion%3A+%222010-09-09%22%0AResources%3A%0A++MySecondQueue%3A%0A++++Type%3A+AWS%3A%3ASQS%3A%3AQueue%0A++++Properties%3A%0A++++++RedrivePolicy%3A%0A++++++++deadLetterTargetArn%3A%0A++++++++++Fn%3A%3AGetAtt%3A%0A++++++++++-+%22MyDeadLetterQueue%22%0A++++++++++-+%22Arn%22%0A++++++++maxReceiveCount%3A+5++++%0A++MySourceQueue%3A%0A++++Type%3A+AWS%3A%3ASQS%3A%3AQueue%0A++++Properties%3A%0A++++++RedrivePolicy%3A%0A++++++++deadLetterTargetArn%3A%0A++++++++++Fn%3A%3AGetAtt%3A%0A++++++++++-+%22MyDeadLetterQueue%22%0A++++++++++-+%22Arn%22%0A++++++++maxReceiveCount%3A+5%0A++MyDeadLetterQue...
2021-09-18T13:04:20.340Z INFO workers.Stack Received follow request {"UID": "6f685593-2197-481c-ba15-1770743eceed", "Stack ID": "arn:aws:cloudformation:us-east-2:641875867446:stack/my-queue/48d82770-0928-11ec-8191-0a9b430955fa"}
2021-09-18T13:04:20.340Z INFO workers.Stack Following Stack {"StackID": "arn:aws:cloudformation:us-east-2:641875867446:stack/my-queue/48d82770-0928-11ec-8191-0a9b430955fa", "Following": false}
2021-09-18T13:04:20.340Z INFO workers.Stack Now following Stack {"StackID": "arn:aws:cloudformation:us-east-2:641875867446:stack/my-queue/48d82770-0928-11ec-8191-0a9b430955fa"}
SDK 2021/09/18 13:04:20 DEBUG Request
POST / HTTP/1.1
Host: cloudformation.us-east-2.amazonaws.com
User-Agent: aws-sdk-go-v2/1.9.0 os/linux lang/go/1.17.1 md/GOOS/linux md/GOARCH/amd64 api/cloudformation/1.10.0
Content-Length: 162
Amz-Sdk-Invocation-Id: 2a9bb148-d1ec-472a-a4c5-4eb42484292b
Amz-Sdk-Request: attempt=1; max=3
Authorization: AWS4-HMAC-SHA256 Credential=AKIAZK4WIO43BHEGSO4R/20210918/us-east-2/cloudformation/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date, Signature=28a1a796be1f0dc7fc8790672999d23dbb0fa398e9e9284a1a41d6c3c6569076
Content-Type: application/x-www-form-urlencoded
X-Amz-Date: 20210918T130420Z
Accept-Encoding: gzip
Attempting to send empty string array to UpdateStack:
Action=UpdateStack&RoleARN=arn%3Aaws%3Aiam%3A%3A641875867446%3Arole%2Fcf-resources-allowed&StackName=my-queue&Tags.member.1.Key=kubernetes.io%2Fcontrolled-by&Tags.member.1.Value=cloudformation.cuppett.com%2Foperator&Tags.member.2.Key=kubernetes.io%2Fowned-by&Tags.member.2.Value=6f685593-2197-481c-ba15-1770743eceed&TemplateBody=---%0AAWSTemplateFormatVersion%3A+%222010-09-09%22%0AResources%3A%0A++MySecondQueue%3A%0A++++Type%3A+AWS%3A%3ASQS%3A%3AQueue%0A++++Properties%3A%0A++++++RedrivePolicy%3A%0A++++++++deadLetterTargetArn%3A%0A++++++++++Fn%3A%3AGetAtt%3A%0A++++++++++-+%22MyDeadLetterQueue%22%0A++++++++++-+%22Arn%22%0A++++++++maxReceiveCount%3A+5++++%0A++MySourceQueue%3A%0A++++Type%3A+AWS%3A%3ASQS%3A%3AQueue%0A++++Properties%3A%0A++++++RedrivePolicy%3A%0A++++++++deadLetterTargetArn%3A%0A++++++++++Fn%3A%3AGetAtt%3A%0A++++++++++-+%22MyDeadLetterQueue%22%0A++++++++++-+%22Arn%22%0A++++++++maxReceiveCount%3A+5%0A++MyDeadLetterQueue%3A%0A++++Type%3A+AWS%3A%3ASQS%3A%3AQueue%0AOutputs%3A%0A++SecondQueueURL%3A%0A++...
SDK 2021/09/18 13:07:02 DEBUG request failed with unretryable error https response error StatusCode: 400, RequestID: bcd1c225-e96a-430c-aafa-711819798c38, api error ValidationError: No updates are to be performed.
This happens whether the template differs or not (NotificationARNs.member isn't part of the payload).
Hi, can you confirm if this is still persisting with the latest version of SDK?
Yes, this is still the same with go 1.18 and the following SDK versions:
github.com/aws/aws-sdk-go-v2 v1.16.2
github.com/aws/aws-sdk-go-v2/config v1.15.3
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.20.3
github.com/aws/aws-sdk-go-v2/service/sts v1.16.3
This was an issue with serialization in the awsquery protocol which we fixed earlier this year with #2010.
I've just verified that NotificationARNs: []string{} is now represented correctly in the request body:
POST / HTTP/1.1
Host: cloudformation.us-east-1.amazonaws.com
User-Agent: aws-sdk-go-v2/1.21.0 os/macos lang/go#1.21.0 md/GOOS#darwin md/GOARCH#amd64 api/cloudformation#1.34.6
Content-Length: 69
Amz-Sdk-Invocation-Id: ...
Amz-Sdk-Request: attempt=1; max=3
Authorization: ...
Content-Type: application/x-www-form-urlencoded
X-Amz-Date: 20230918T221425Z
X-Amz-Security-Token: ...
Accept-Encoding: gzip
Action=UpdateStack&NotificationARNs=&StackName=foo&Version=2010-05-15
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.