Skip to content

Commit 3dd834d

Browse files
authored
feat(appconfig): constrain environments to a single deployment at a time (#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*
1 parent 99041b2 commit 3dd834d

13 files changed

+1224
-16
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/appconfigmulticonfigenvDefaultTestDeployAssert1621E45D.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/appconfigmulticonfigenvDefaultTestDeployAssert1621E45D.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/aws-appconfig-multi-config-env.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"Resources": {
3+
"MyApplicationForEnv1F597ED9": {
4+
"Type": "AWS::AppConfig::Application",
5+
"Properties": {
6+
"Name": "awsappconfigmulticonfigenv-MyApplicationForEnv-1EE3EA95"
7+
}
8+
},
9+
"MultiConfigEnvironment5F41B747": {
10+
"Type": "AWS::AppConfig::Environment",
11+
"Properties": {
12+
"ApplicationId": {
13+
"Ref": "MyApplicationForEnv1F597ED9"
14+
},
15+
"Name": "awsappconfigmulticonfigenv-MultiConfigEnvironment-59525230"
16+
}
17+
},
18+
"QuickDeploymentStrategy980252EC": {
19+
"Type": "AWS::AppConfig::DeploymentStrategy",
20+
"Properties": {
21+
"DeploymentDurationInMinutes": 1,
22+
"GrowthFactor": 50,
23+
"GrowthType": "LINEAR",
24+
"Name": "awsappconfigmulticonfigenv-QuickDeploymentStrategy-CAB72574",
25+
"ReplicateTo": "NONE"
26+
}
27+
},
28+
"MyFirstConfigConfigurationProfileAB11F87A": {
29+
"Type": "AWS::AppConfig::ConfigurationProfile",
30+
"Properties": {
31+
"ApplicationId": {
32+
"Ref": "MyApplicationForEnv1F597ED9"
33+
},
34+
"LocationUri": "hosted",
35+
"Name": "awsappconfigmulticonfigenv-MyFirstConfig-2FF7CAAB"
36+
}
37+
},
38+
"MyFirstConfig117AFBAC": {
39+
"Type": "AWS::AppConfig::HostedConfigurationVersion",
40+
"Properties": {
41+
"ApplicationId": {
42+
"Ref": "MyApplicationForEnv1F597ED9"
43+
},
44+
"ConfigurationProfileId": {
45+
"Ref": "MyFirstConfigConfigurationProfileAB11F87A"
46+
},
47+
"Content": "first config content",
48+
"ContentType": "application/octet-stream"
49+
},
50+
"UpdateReplacePolicy": "Retain",
51+
"DeletionPolicy": "Retain"
52+
},
53+
"MyFirstConfigDeployment5AEBAD52B8EE4": {
54+
"Type": "AWS::AppConfig::Deployment",
55+
"Properties": {
56+
"ApplicationId": {
57+
"Ref": "MyApplicationForEnv1F597ED9"
58+
},
59+
"ConfigurationProfileId": {
60+
"Ref": "MyFirstConfigConfigurationProfileAB11F87A"
61+
},
62+
"ConfigurationVersion": {
63+
"Ref": "MyFirstConfig117AFBAC"
64+
},
65+
"DeploymentStrategyId": {
66+
"Ref": "QuickDeploymentStrategy980252EC"
67+
},
68+
"EnvironmentId": {
69+
"Ref": "MultiConfigEnvironment5F41B747"
70+
}
71+
}
72+
},
73+
"MySecondConfigConfigurationProfileD0CC1BAA": {
74+
"Type": "AWS::AppConfig::ConfigurationProfile",
75+
"Properties": {
76+
"ApplicationId": {
77+
"Ref": "MyApplicationForEnv1F597ED9"
78+
},
79+
"LocationUri": "hosted",
80+
"Name": "awsappconfigmulticonfigenv-MySecondConfig-4F837809"
81+
}
82+
},
83+
"MySecondConfig28DEBAC4": {
84+
"Type": "AWS::AppConfig::HostedConfigurationVersion",
85+
"Properties": {
86+
"ApplicationId": {
87+
"Ref": "MyApplicationForEnv1F597ED9"
88+
},
89+
"ConfigurationProfileId": {
90+
"Ref": "MySecondConfigConfigurationProfileD0CC1BAA"
91+
},
92+
"Content": "second config content",
93+
"ContentType": "application/octet-stream"
94+
},
95+
"UpdateReplacePolicy": "Retain",
96+
"DeletionPolicy": "Retain"
97+
},
98+
"MySecondConfigDeployment5AEBAD1470BE4": {
99+
"Type": "AWS::AppConfig::Deployment",
100+
"Properties": {
101+
"ApplicationId": {
102+
"Ref": "MyApplicationForEnv1F597ED9"
103+
},
104+
"ConfigurationProfileId": {
105+
"Ref": "MySecondConfigConfigurationProfileD0CC1BAA"
106+
},
107+
"ConfigurationVersion": {
108+
"Ref": "MySecondConfig28DEBAC4"
109+
},
110+
"DeploymentStrategyId": {
111+
"Ref": "QuickDeploymentStrategy980252EC"
112+
},
113+
"EnvironmentId": {
114+
"Ref": "MultiConfigEnvironment5F41B747"
115+
}
116+
},
117+
"DependsOn": [
118+
"MyFirstConfigDeployment5AEBAD52B8EE4"
119+
]
120+
}
121+
},
122+
"Parameters": {
123+
"BootstrapVersion": {
124+
"Type": "AWS::SSM::Parameter::Value<String>",
125+
"Default": "/cdk-bootstrap/hnb659fds/version",
126+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
127+
}
128+
},
129+
"Rules": {
130+
"CheckBootstrapVersion": {
131+
"Assertions": [
132+
{
133+
"Assert": {
134+
"Fn::Not": [
135+
{
136+
"Fn::Contains": [
137+
[
138+
"1",
139+
"2",
140+
"3",
141+
"4",
142+
"5"
143+
],
144+
{
145+
"Ref": "BootstrapVersion"
146+
}
147+
]
148+
}
149+
]
150+
},
151+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
152+
}
153+
]
154+
}
155+
}
156+
}

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.multi-config-env.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)