Hi There,
I'm having an issue with my app config deployment. The stack is deploying fine, I have an alarm that I can trigger off lambda errors and that works fine also. The issue I'm having is, when I start a deployment and then trigger the alarm the deployment completes successfully. If I deploy the config whilst the alarm is triggered the deployment completes successfully also. In other words, I cannot get it to fail at all. I have tried an alarm on the lambda and a metric filter. Nothing seems to work. The current alarm i have is attached to the lambda and triggers on error. It works fine.
Any help is appreciated
var paramDiscountCode = new CfnParameter(this, "discountCode", {
type: "String",
});
this.appconfigApplication = new appconfig.CfnApplication(
this,
"DiscountCodeAppConfigApp",
{
name: "DiscountCodeApp",
}
);
this.appconfigConfigurationProfile = new appconfig.CfnConfigurationProfile(
this,
"DiscountCodeConfigurationProfile",
{
applicationId: this.appconfigApplication.ref,
locationUri: "hosted",
name: "DiscountCodeConfigurationProfile",
type: "AWS.AppConfig.FeatureFlags",
}
);
const role = new Role(this, "MyRole", {
assumedBy: new ServicePrincipal("appconfig.amazonaws.com"),
});
role.addToPolicy(
new PolicyStatement({
resources: [
"arn:aws:cloudwatch:ap-southeast-2:123456789012:alarm/myAlarm",
],
actions: ["cloudwatch:DescribeAlarms"],
})
);
const cfnHostedConfigurationVersion =
new appconfig.CfnHostedConfigurationVersion(
this,
"MyCfnHostedConfigurationVersion",
{
applicationId: this.appconfigApplication.ref,
configurationProfileId: this.appconfigConfigurationProfile.ref,
contentType: "application/json",
content: JSON.stringify({
version: "1",
flags: {
discountCodeEnabled: {
name:
"Discount Code " + paramDiscountCode.valueAsString + " Flag",
},
},
values: {
discountCodeEnabled: {
enabled: true,
},
},
}),
}
);
this.appconfigEnv = new appconfig.CfnEnvironment(
this,
"DiscountCodeEnvironment",
{
applicationId: this.appconfigApplication.ref,
name: "dev",
},
monitors: [{
alarmArn: 'arn:aws:cloudwatch:ap-southeast-2:123456789012:alarm/myAlarm',
alarmRoleArn: Role.arn,
}],
);
this.discountCodeDeploymentStrategy = new appconfig.CfnDeploymentStrategy(
this,
"DiscountCodeDeploymentStrategy",
{
deploymentDurationInMinutes: 0,
growthFactor: 100,
name: "discountCodeDeploymentStrategy",
replicateTo: "NONE",
finalBakeTimeInMinutes: 0,
}
);
const deployment = new appconfig.CfnDeployment(this, "InitialDeployment", {
applicationId: this.appconfigApplication.ref,
configurationProfileId: this.appconfigConfigurationProfile.ref,
configurationVersion: cfnHostedConfigurationVersion.ref,
deploymentStrategyId: this.discountCodeDeploymentStrategy.ref,
environmentId: this.appconfigEnv.ref,
});