-
Notifications
You must be signed in to change notification settings - Fork 151
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
When deploying ECS service with blue/green deployment, task definition and target group changes can't be ignored #1096
Comments
Does |
I tried running |
is there any update on this? What's the recommended approach when we have, for example, an AWS Fargate with services and task definitions, and we want to deploy new version of a service, but ignore existing ones? I thought of running |
Possibly related: pulumi/pulumi-terraform-bridge#1756 |
I've spent most of the day on this, and I have hacked a solution together. From looking at old terraform issues / CDK issues - its quite disappointing that we have to hack around AWS on this. In an ideal world AWS ECS should just turn the task definition update into a new deployment on code deploy, I found a relevant issue on CloudFormation aws-cloudformation/cloudformation-coverage-roadmap#1529 But I don't believe pulumi or terraform utilise CloudFormation - so I'm resorting to a hacky method while I investigate further. But here's what I'm doing
const service = new awsx.ecs.FargateService(
'templi-api',
{
cluster: baseInfra.requireOutput('clusterArn'),
enableExecuteCommand: true,
deploymentController: {
type: 'CODE_DEPLOY',
},
networkConfiguration: {
securityGroups: [apiSecurityGroup.id],
assignPublicIp: true,
subnets: baseInfra.requireOutput('vpcPublicSubnetIds'),
},
continueBeforeSteadyState: true,
// TODO: this is hardcoded as nginx due to a bug with pulumi not being able
// to ignore changes on the task definition
// As our deployments are handled by code deploy, we should ignore changes on the task definition
taskDefinition: 'nginx:latest',
loadBalancers: [
{
containerPort: 80,
containerName: 'templi-api',
targetGroupArn: blueTargetGroup.arn,
},
],
},
{
ignoreChanges: ['taskDefinition'],
}
);
const deployment = latestTaskDefinitionArn.apply((arn) => {
const appSpecJson = JSON.stringify({
version: 0.0,
Resources: [
{
TargetService: {
Type: 'AWS::ECS::Service',
Properties: {
TaskDefinition: arn,
LoadBalancerInfo: {
ContainerName: 'templi-api',
ContainerPort: 80,
},
},
},
},
],
});
const cliInputJson = JSON.stringify({
applicationName: 'templi-api',
deploymentGroupName: 'api-deployment-group',
revision: {
revisionType: 'AppSpecContent',
appSpecContent: {
content: appSpecJson,
},
},
});
return new local.Command('create-deployment', {
create: `aws deploy create-deployment --cli-input-json '${cliInputJson}'`,
environment: {
CACHE_BUSTER: new Date().getTime().toString(),
},
});
});
export const deploymentId = deployment.stdout; |
I created a stack deploying ECS service with blue/green deployment(CodeDeploy) using aws.ecs.Service().
After the creation of the service in AWS, when running "pulumi up" again without any change to the existing service, Pulumi detects there was an update to the service.(because the TG or task definition revision was changed on AWS)
Pulumi up -> the service is created.
Running Pulum up without making any changes -> an update is detected on the service.
Because of AWS limitations, the update fails : “InvalidParameterException: Unable to update network parameters on services with a CODE_DEPLOY deployment controller. Use AWS CodeDeploy to trigger a new deployment.”
I tried using the "ignore changes" and transformations properties when creating the service but it didn't help.
The issue forces me to delete all existing services and recreate them, If I need to make additional changes to the stack.
Related issues:
pulumi/pulumi-awsx#856
#1982
The service code:
The text was updated successfully, but these errors were encountered: