Skip to content

AWS/Terraform Autoscaling instance refresh, can we have multiple triggers for different use cases.?.  #71

@KeerthigaKrishnan

Description

@KeerthigaKrishnan

Hi Team,

I have written terraform code for any version change , it triggers autoscaling. But i want to include other variable in triggers as below. But it is failing with "'pass_test' is not a recognized parameter name for aws_autoscaling_group".

code

+++
resource "aws_autoscaling_group" "ec2_group" {
name = "${local.full_asg_name}-asg"
desired_capacity = var.desired_capacity
max_size = var.max_capacity
min_size = var.min_capacity
vpc_zone_identifier = var.instance_subnets
target_group_arns = [aws_alb_target_group.asg_alb_target_group.arn, aws_lb_target_group.asg_nlb_target_group.arn]
health_check_type = var.health_check_type
suspended_processes = var.suspend_process
launch_template {
id = aws_launch_template.asg_template.id
version = var.template_version
}
instance_refresh {
strategy = "Rolling"
preferences {
min_healthy_percentage = 0
}
triggers = ["tag","pass_test"]
}

tag {
key = "Name"
value = local.full_asg_name
propagate_at_launch = true
}

tag {
key = "subsystem"
value = var.subsystem
propagate_at_launch = true
}

tag {
key = "component"
value = var.component
propagate_at_launch = true
}

tag {
key = "environment"
value = var.environment
propagate_at_launch = true
}
tag {
key = "build"
value = var.tag
propagate_at_launch = true
}
tag {
key = var.tag
value = var.tag
propagate_at_launch = true
}
tag {
key = "Rotating Password"
value = var.pass_test
propagate_at_launch = true
}
}
+++

When i execute this, I am getting below error :

++

│ Error: 'pass_test' is not a recognized parameter name for aws_autoscaling_group

│ with module.auto_environment.module.postx_asg.aws_autoscaling_group.ec2_group,
│ on ../modules/aws/asg_alb_nlb/main.tf line 113, in resource "aws_autoscaling_group" "ec2_group":
│ 113: triggers = ["tag","pass_test"]
++

Use case : Every 3 months, we will be rotating db passwords by updating this variable "pass_test". It is rotated but instance refresh is manual here, where there is no trigger. I am trying to add those variable as a trigger here, but it s not working. Any help would be appareciated.

Thanks
K.Keerthiga

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions