Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(appconfig): deployment recreated on every cdk deployment #28782

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 1 addition & 25 deletions packages/@aws-cdk/aws-appconfig-alpha/lib/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE
});
}

protected abstract getDeploymentHash(environment: IEnvironment): string;

/**
* Adds an extension defined by the action point and event destination
* and also creates an extension association to the configuration profile.
Expand Down Expand Up @@ -312,8 +310,7 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE
* please take a look into https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig.CfnDeployment.html.
*/
public deploy(environment: IEnvironment) {
const logicalId = `Deployment${this.getDeploymentHash(environment)}`;
new CfnDeployment(this, logicalId, {
new CfnDeployment(this, `Deployment${getHash(environment.name!)}`, {
applicationId: this.application.applicationId,
configurationProfileId: this.configurationProfileId,
deploymentStrategyId: this.deploymentStrategy!.deploymentStrategyId,
Expand Down Expand Up @@ -485,16 +482,6 @@ export class HostedConfiguration extends ConfigurationBase {
this.addExistingEnvironmentsToApplication();
this.deployConfigToEnvironments();
}

protected getDeploymentHash(environment: IEnvironment): string {
const combinedString = `
${this.application!.name!}
${this.name!}
${environment.name!}
${this.content}
`;
return getHash(combinedString);
}
}

/**
Expand Down Expand Up @@ -626,17 +613,6 @@ export class SourcedConfiguration extends ConfigurationBase {
this.deployConfigToEnvironments();
}

protected getDeploymentHash(environment: IEnvironment): string {
const combinedString = `
${this.application!.name!}
${this.name!}
${environment.name!}
${this.versionNumber}
${this.location.type}
`;
return getHash(combinedString);
}

private getPolicyForRole(): iam.PolicyDocument {
const policy = new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
Expand Down
Binary file not shown.

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 @@ -168,7 +168,7 @@
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"MyHostedConfigDeploymentE4742E8E64DF4": {
"MyHostedConfigDeployment8E5DB1FCC9183": {
"Type": "AWS::AppConfig::Deployment",
"Properties": {
"ApplicationId": {
Expand Down Expand Up @@ -213,7 +213,7 @@
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"MyHostedConfigFromJsonDeploymentCD82E3049E374": {
"MyHostedConfigFromJsonDeployment3AC6ED5A2933B": {
"Type": "AWS::AppConfig::Deployment",
"Properties": {
"ApplicationId": {
Expand All @@ -233,7 +233,7 @@
}
}
},
"MyHostedConfigFromJsonDeploymentEFECDBC4087F1": {
"MyHostedConfigFromJsonDeploymentFA00BC528601D": {
"Type": "AWS::AppConfig::Deployment",
"Properties": {
"ApplicationId": {
Expand Down Expand Up @@ -278,7 +278,7 @@
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"MyHostedConfigFromYamlDeploymentFE9624CBE5FC6": {
"MyHostedConfigFromYamlDeploymentD93A5BDCCAAB2": {
"Type": "AWS::AppConfig::Deployment",
"Properties": {
"ApplicationId": {
Expand Down Expand Up @@ -472,7 +472,7 @@
]
}
},
"MyConfigFromParameterDeployment0C84B4B3BAD6B": {
"MyConfigFromParameterDeployment28051DE6185BF": {
"Type": "AWS::AppConfig::Deployment",
"Properties": {
"ApplicationId": {
Expand Down Expand Up @@ -593,7 +593,7 @@
}
}
},
"MyConfigFromDocumentDeployment1520EE7C916D3": {
"MyConfigFromDocumentDeployment7A5BA9D7D69C3": {
"Type": "AWS::AppConfig::Deployment",
"Properties": {
"ApplicationId": {
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.

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.