热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Changinglaunchconfigurationsettingsresultsinanerror

WehavethistfcodetocreateandlaunchEC2instancesviaASG:

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 (

1
var.redash_ami

),

1
terraform plan

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

1
terraform apply

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!


   



推荐阅读
author-avatar
仔田
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有