Setting isCreated flag when domain is created so that if the handler retries for any reason, we don't get a 409. The flag state gets preserved if the handler set it and it gets called again.
Testing
Ran lambda locally with a context delay to force a retry and the retry succeeded without a 409.
[CREATE] invoking handler...
Domain was already created, will not call CreateDomain again.
AWS::CodeArtifact::Domain read handler is being invoked
AWS::CodeArtifact::Domain describeDomain is being invoked
{"apiRequest": {"requestId": "1f39dc8d-c2c2-4313-ba69-b1e3a770d574", "requestName": "DescribeDomainRequest"}}
AWS::CodeArtifact::Domain has successfully been read.
AWS::CodeArtifact::Domain getDomainPolicy is being invoked
Failed to execute remote function: {No policy found for (domain): (domain-retried) (Service: Codeartifact, Status Code: 404, Request ID: a69ecfec-53c2-4faa-bbd9-adf419b985c9, Extended Request ID: null)}
Domain policy of AWS::CodeArtifact::Domain has successfully been read.
[CREATE] handler invoked
Handler returned SUCCESS
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available:
Description of changes:
Setting
isCreated
flag when domain is created so that if the handler retries for any reason, we don't get a 409. The flag state gets preserved if the handler set it and it gets called again.Testing Ran lambda locally with a context delay to force a retry and the retry succeeded without a 409.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.