-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(appconfig): constrain environments to a single deployment at a t…
…ime (#29500) ### Issue # (if applicable) Closes #29345. ### Reason for this change The current L2 AppConfig constructs do not have any guardrails that prevent simultaneous Deployments to a single Environment. This is not allowed, and will result in Cfn deploy-time conflicts. ### Description of changes This commit adds a pair of new public methods to IEnvironment that enable the addition of a new Deployment for a given IConfiguration. It then updates the creation of new Deployments in ConfigurationBase to utilize these new methods instead of the current resource creation. These new methods interact with an internal queue. This queue creates a chain of Cfn dependencies between Deployments in order to enforce that only a single Deployment can be in progress for the Environment at any given time. ### Description of how you validated changes Added new unit and integ test coverage. Deployed the new integ test without these changes and confirmed that Cfn failed at deployment time. ### 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
Showing
13 changed files
with
1,224 additions
and
16 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...config-env.js.snapshot/appconfigmulticonfigenvDefaultTestDeployAssert1621E45D.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...nfig-env.js.snapshot/appconfigmulticonfigenvDefaultTestDeployAssert1621E45D.template.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...config/test/integ.multi-config-env.js.snapshot/aws-appconfig-multi-config-env.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
156 changes: 156 additions & 0 deletions
156
...nfig/test/integ.multi-config-env.js.snapshot/aws-appconfig-multi-config-env.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
{ | ||
"Resources": { | ||
"MyApplicationForEnv1F597ED9": { | ||
"Type": "AWS::AppConfig::Application", | ||
"Properties": { | ||
"Name": "awsappconfigmulticonfigenv-MyApplicationForEnv-1EE3EA95" | ||
} | ||
}, | ||
"MultiConfigEnvironment5F41B747": { | ||
"Type": "AWS::AppConfig::Environment", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"Name": "awsappconfigmulticonfigenv-MultiConfigEnvironment-59525230" | ||
} | ||
}, | ||
"QuickDeploymentStrategy980252EC": { | ||
"Type": "AWS::AppConfig::DeploymentStrategy", | ||
"Properties": { | ||
"DeploymentDurationInMinutes": 1, | ||
"GrowthFactor": 50, | ||
"GrowthType": "LINEAR", | ||
"Name": "awsappconfigmulticonfigenv-QuickDeploymentStrategy-CAB72574", | ||
"ReplicateTo": "NONE" | ||
} | ||
}, | ||
"MyFirstConfigConfigurationProfileAB11F87A": { | ||
"Type": "AWS::AppConfig::ConfigurationProfile", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"LocationUri": "hosted", | ||
"Name": "awsappconfigmulticonfigenv-MyFirstConfig-2FF7CAAB" | ||
} | ||
}, | ||
"MyFirstConfig117AFBAC": { | ||
"Type": "AWS::AppConfig::HostedConfigurationVersion", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MyFirstConfigConfigurationProfileAB11F87A" | ||
}, | ||
"Content": "first config content", | ||
"ContentType": "application/octet-stream" | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"MyFirstConfigDeployment5AEBAD52B8EE4": { | ||
"Type": "AWS::AppConfig::Deployment", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MyFirstConfigConfigurationProfileAB11F87A" | ||
}, | ||
"ConfigurationVersion": { | ||
"Ref": "MyFirstConfig117AFBAC" | ||
}, | ||
"DeploymentStrategyId": { | ||
"Ref": "QuickDeploymentStrategy980252EC" | ||
}, | ||
"EnvironmentId": { | ||
"Ref": "MultiConfigEnvironment5F41B747" | ||
} | ||
} | ||
}, | ||
"MySecondConfigConfigurationProfileD0CC1BAA": { | ||
"Type": "AWS::AppConfig::ConfigurationProfile", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"LocationUri": "hosted", | ||
"Name": "awsappconfigmulticonfigenv-MySecondConfig-4F837809" | ||
} | ||
}, | ||
"MySecondConfig28DEBAC4": { | ||
"Type": "AWS::AppConfig::HostedConfigurationVersion", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MySecondConfigConfigurationProfileD0CC1BAA" | ||
}, | ||
"Content": "second config content", | ||
"ContentType": "application/octet-stream" | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"MySecondConfigDeployment5AEBAD1470BE4": { | ||
"Type": "AWS::AppConfig::Deployment", | ||
"Properties": { | ||
"ApplicationId": { | ||
"Ref": "MyApplicationForEnv1F597ED9" | ||
}, | ||
"ConfigurationProfileId": { | ||
"Ref": "MySecondConfigConfigurationProfileD0CC1BAA" | ||
}, | ||
"ConfigurationVersion": { | ||
"Ref": "MySecondConfig28DEBAC4" | ||
}, | ||
"DeploymentStrategyId": { | ||
"Ref": "QuickDeploymentStrategy980252EC" | ||
}, | ||
"EnvironmentId": { | ||
"Ref": "MultiConfigEnvironment5F41B747" | ||
} | ||
}, | ||
"DependsOn": [ | ||
"MyFirstConfigDeployment5AEBAD52B8EE4" | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...esting/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/cdk.out
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...ing/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/integ.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.