Skip to content

Commit

Permalink
fix(custom-resources): logApiResponseData is added to custom resour…
Browse files Browse the repository at this point in the history
…ce event properties by default (aws#30418)

Closes aws#30121, aws#29949

### Reason for this change

PR aws#29648 introduced a new resource property `logApiResponseData`. This resource property is `true` by default which forces an update for `AwsCustomResource`. For users without `onUpdate` configured an empty data object is returned if no SDK call is configured. This can cause an attribute error if the user is depending on a data from a specific SDK call.

### Description of changes

Made `logApiResponseData` undefined by default which will not trigger `onUpdate`. To maintain backwards compatibility with the original PR introducing `logApiResponseData` as true by default, I've also introduced a feature flag that will allow users to keep the current behavior so they aren't now forced into another `onUpdate` event.

### Description of how you validated changes

Updated unit tests where `logApiResponseData` was added as a resource property. Added new unit test to verify that `logApiResponseData` could be added to the event. Updated unit tests that test `_render()` to ensure that the default case will result in an empty object. Updated integ tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
colifran authored and Leonardo Gama committed Jun 11, 2024
1 parent 013cf02 commit 0b91e02
Show file tree
Hide file tree
Showing 222 changed files with 3,774 additions and 34,719 deletions.

This file was deleted.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"Arn"
]
},
"Create": "{\"service\":\"CodeDeploy\",\"action\":\"createDeploymentConfig\",\"parameters\":{\"deploymentConfigName\":\"hello\",\"computePlatform\":\"Lambda\",\"trafficRoutingConfig\":{\"type\":\"TimeBasedLinear\",\"timeBasedLinear\":{\"linearInterval\":1,\"linearPercentage\":5}}},\"physicalResourceId\":{\"id\":\"hello\"},\"logApiResponseData\":true}",
"Update": "{\"service\":\"CodeDeploy\",\"action\":\"createDeploymentConfig\",\"parameters\":{\"deploymentConfigName\":\"hello\",\"computePlatform\":\"Lambda\",\"trafficRoutingConfig\":{\"type\":\"TimeBasedLinear\",\"timeBasedLinear\":{\"linearInterval\":1,\"linearPercentage\":5}}},\"physicalResourceId\":{\"id\":\"hello\"},\"logApiResponseData\":true}",
"Delete": "{\"service\":\"CodeDeploy\",\"action\":\"deleteDeploymentConfig\",\"parameters\":{\"deploymentConfigName\":\"hello\"},\"logApiResponseData\":true}",
"Create": "{\"service\":\"CodeDeploy\",\"action\":\"createDeploymentConfig\",\"parameters\":{\"deploymentConfigName\":\"hello\",\"computePlatform\":\"Lambda\",\"trafficRoutingConfig\":{\"type\":\"TimeBasedLinear\",\"timeBasedLinear\":{\"linearInterval\":1,\"linearPercentage\":5}}},\"physicalResourceId\":{\"id\":\"hello\"}}",
"Update": "{\"service\":\"CodeDeploy\",\"action\":\"createDeploymentConfig\",\"parameters\":{\"deploymentConfigName\":\"hello\",\"computePlatform\":\"Lambda\",\"trafficRoutingConfig\":{\"type\":\"TimeBasedLinear\",\"timeBasedLinear\":{\"linearInterval\":1,\"linearPercentage\":5}}},\"physicalResourceId\":{\"id\":\"hello\"}}",
"Delete": "{\"service\":\"CodeDeploy\",\"action\":\"deleteDeploymentConfig\",\"parameters\":{\"deploymentConfigName\":\"hello\"}}",
"InstallLatestAwsSdk": false
},
"DependsOn": [
Expand Down Expand Up @@ -95,7 +95,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "6c34b6e864223e202d50bb862e2bf066393d4cdf36229f8e1646425a5224a10b.zip"
"S3Key": "746da84b10e215c552e68b6d2061024e4429f0386f43a35ef5e4d2940655692e.zip"
},
"Handler": "index.handler",
"Role": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
{
"Ref": "myuserpoolmyuserpoolclientAFB2274E"
},
"\"},\"logApiResponseData\":true}"
"\"}}"
]
]
},
Expand All @@ -152,7 +152,7 @@
{
"Ref": "myuserpoolmyuserpoolclientAFB2274E"
},
"\"},\"logApiResponseData\":true}"
"\"}}"
]
]
},
Expand Down Expand Up @@ -228,7 +228,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "6c34b6e864223e202d50bb862e2bf066393d4cdf36229f8e1646425a5224a10b.zip"
"S3Key": "746da84b10e215c552e68b6d2061024e4429f0386f43a35ef5e4d2940655692e.zip"
},
"Handler": "index.handler",
"Role": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
{
"Ref": "poolclient2623294C"
},
"\"},\"logApiResponseData\":true}"
"\"}}"
]
]
},
Expand All @@ -111,7 +111,7 @@
{
"Ref": "poolclient2623294C"
},
"\"},\"logApiResponseData\":true}"
"\"}}"
]
]
},
Expand Down Expand Up @@ -187,7 +187,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "6c34b6e864223e202d50bb862e2bf066393d4cdf36229f8e1646425a5224a10b.zip"
"S3Key": "746da84b10e215c552e68b6d2061024e4429f0386f43a35ef5e4d2940655692e.zip"
},
"Handler": "index.handler",
"Role": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
{
"Ref": "UserPoolDomainD0EA232A"
},
"\"},\"logApiResponseData\":true}"
"\"}}"
]
]
},
Expand All @@ -77,7 +77,7 @@
{
"Ref": "UserPoolDomainD0EA232A"
},
"\"},\"logApiResponseData\":true}"
"\"}}"
]
]
},
Expand Down Expand Up @@ -148,7 +148,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "6c34b6e864223e202d50bb862e2bf066393d4cdf36229f8e1646425a5224a10b.zip"
"S3Key": "746da84b10e215c552e68b6d2061024e4429f0386f43a35ef5e4d2940655692e.zip"
},
"Handler": "index.handler",
"Role": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@
{
"Ref": "UserPool6BA7E5F2"
},
"\",\"Username\":\"[email protected]\",\"UserAttributes\":[{\"Name\":\"email\",\"Value\":\"[email protected]\"},{\"Name\":\"email_verified\",\"Value\":\"true\"}],\"MessageAction\":\"SUPPRESS\"},\"physicalResourceId\":{\"id\":\"User\"},\"logApiResponseData\":true}"
"\",\"Username\":\"[email protected]\",\"UserAttributes\":[{\"Name\":\"email\",\"Value\":\"[email protected]\"},{\"Name\":\"email_verified\",\"Value\":\"true\"}],\"MessageAction\":\"SUPPRESS\"},\"physicalResourceId\":{\"id\":\"User\"}}"
]
]
},
"InstallLatestAwsSdk": "false"
"InstallLatestAwsSdk": false
},
"DependsOn": [
"UserCustomResourcePolicyC2EB5139"
Expand Down Expand Up @@ -745,11 +745,11 @@
"User.Username"
]
},
"\",\"Password\":\"TestUser@123\",\"Permanent\":true},\"physicalResourceId\":{\"id\":\"SetUserPassword\"},\"logApiResponseData\":true}"
"\",\"Password\":\"TestUser@123\",\"Permanent\":true},\"physicalResourceId\":{\"id\":\"SetUserPassword\"}}"
]
]
},
"InstallLatestAwsSdk": "false"
"InstallLatestAwsSdk": false
},
"DependsOn": [
"UserCustomResourcePolicyC2EB5139",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b91e02

Please sign in to comment.