作者:仔田 | 来源:互联网 | 2023-09-03 17:19
We have this tf code to create and launch EC2 instances via ASG:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| resource "aws_launch_configuration" "redash" {
name = "redash"
image_id = "${var.redash_ami}"
instance_type = "t2.small"
security_groups = ["${aws_security_group.allow_all.id}"]
associate_public_ip_address = true
iam_instance_profile = "${aws_iam_instance_profile.emr_profile.arn}"
depends_on = ["aws_emr_cluster.querying"]
enable_monitoring = false
lifecycle {
create_before_destroy = true
}
}
resource "aws_autoscaling_group" "redash" {
name = "redash"
max_size = "1"
min_size = "0"
desired_capacity = "1"
default_cooldown = 30
force_delete = true
launch_configuration = "${aws_launch_configuration.redash.id}"
vpc_zone_identifier = ["${aws_subnet.main.id}"]
tag {
key = "Name"
value = "redash"
propagate_at_launch = true
}
lifecycle {
create_before_destroy = true
}
} |
After changing the machine image (
),
shows this:
1 2 3 4 5 6 7 8 9 10 11
| aws_launch_configuration.redash (new resource required)
associate_public_ip_address: "true" => "true"
ebs_block_device.#: "0" => ""
ebs_optimized: "false" => ""
enable_monitoring: "false" => "false"
iam_instance_profile: "...."
image_id: "ami-9ea12788" => "ami-99f1c7e2" (forces new resource)
instance_type: "t2.small" => "t2.small"
name: "redash" => "redash"
root_block_device.#: "0" => ""
|
However, running
results in this error:
1 2
| * aws_launch_configuration.redash: Error creating launch configuration: AlreadyExists: Launch Configuration by this name already exists - A launch configuration already exists with the name redash
status code: 400, request id: 7a098386-80e1-11e7-b433-13c12dad94bd |
该提问来源于开源项目:hashicorp/terraform-provider-aws
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!