Skip to content
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

non-idempotent ec2 module #10

Closed
d-helios opened this issue Nov 27, 2017 · 6 comments
Closed

non-idempotent ec2 module #10

d-helios opened this issue Nov 27, 2017 · 6 comments

Comments

@d-helios
Copy link

Hi,
I deploy ec2 instance using terraform-aws-ec2-instance module. After that I run one more time terraform apply without changing any resources in code and this leads to destroying my ec2 instance and execution errors.

laptop-A018226:stage dhelios$ terraform apply
aws_vpc.this: Refreshing state... (ID: vpc-7972661f)
aws_db_parameter_group.this: Refreshing state... (ID: zabbix-db-20171127093848981500000001)
data.aws_ami.centos: Refreshing state...
aws_route_table.private[2]: Refreshing state... (ID: rtb-e64d1b9f)
aws_route_table.private[0]: Refreshing state... (ID: rtb-6c491f15)
aws_route_table.private[1]: Refreshing state... (ID: rtb-3f772146)
aws_internet_gateway.this: Refreshing state... (ID: igw-37534e50)
aws_subnet.public[1]: Refreshing state... (ID: subnet-66b2e000)
aws_subnet.public[2]: Refreshing state... (ID: subnet-943224cf)
aws_subnet.public[0]: Refreshing state... (ID: subnet-66b9cb2e)
aws_subnet.database[1]: Refreshing state... (ID: subnet-698fdd0f)
aws_subnet.database[0]: Refreshing state... (ID: subnet-36bfcd7e)
aws_route_table.public: Refreshing state... (ID: rtb-957620ec)
aws_security_group.this: Refreshing state... (ID: sg-881be5f4)
aws_security_group.this: Refreshing state... (ID: sg-121ae46e)
aws_security_group.this: Refreshing state... (ID: sg-731ae40f)
aws_security_group.this: Refreshing state... (ID: sg-9e1fe1e2)
aws_security_group.this: Refreshing state... (ID: sg-6f19e713)
aws_security_group.this: Refreshing state... (ID: sg-9c1ae4e0)
aws_security_group.this: Refreshing state... (ID: sg-371ce24b)
aws_route_table_association.database[1]: Refreshing state... (ID: rtbassoc-4a945c31)
aws_route_table_association.database[0]: Refreshing state... (ID: rtbassoc-e79e569c)
aws_route.public_internet_gateway: Refreshing state... (ID: r-rtb-957620ec1080289494)
aws_route_table_association.public[0]: Refreshing state... (ID: rtbassoc-e0945c9b)
aws_route_table_association.public[2]: Refreshing state... (ID: rtbassoc-49945c32)
aws_route_table_association.public[1]: Refreshing state... (ID: rtbassoc-9f9058e4)
aws_security_group_rule.ingress_rules[1]: Refreshing state... (ID: sgrule-3250443807)
aws_security_group_rule.ingress_rules[0]: Refreshing state... (ID: sgrule-2546528616)
aws_db_subnet_group.this: Refreshing state... (ID: zabbix-db-20171127093910910500000002)
aws_security_group_rule.egress_with_cidr_blocks: Refreshing state... (ID: sgrule-1642609883)
aws_security_group_rule.egress_with_cidr_blocks: Refreshing state... (ID: sgrule-3921041069)
aws_security_group_rule.ingress_rules: Refreshing state... (ID: sgrule-1762131498)
aws_security_group_rule.ingress_with_cidr_blocks[1]: Refreshing state... (ID: sgrule-452473216)
aws_security_group_rule.ingress_with_cidr_blocks[0]: Refreshing state... (ID: sgrule-3187152274)
aws_security_group_rule.ingress_rules: Refreshing state... (ID: sgrule-3615313137)
aws_security_group_rule.ingress_rules[0]: Refreshing state... (ID: sgrule-2145821040)
aws_security_group_rule.ingress_rules[1]: Refreshing state... (ID: sgrule-1660909378)
aws_elb.this: Refreshing state... (ID: zabbix-web-elb)
aws_elb.this: Refreshing state... (ID: zabbix-app-elb)
aws_db_instance.this: Refreshing state... (ID: zabbix-db)
data.template_file.zabbix_app_init: Refreshing state...
data.template_file.zabbix_web_init: Refreshing state...
aws_instance.this: Refreshing state... (ID: i-066ced77fc1428501)
aws_launch_configuration.this: Refreshing state... (ID: zabbix-web-lc-20171127094401928900000004)
aws_launch_configuration.this: Refreshing state... (ID: zabbix-app-lc-20171127094401919300000003)
aws_autoscaling_group.this: Refreshing state... (ID: zabbix-app-asg-20171127094404350700000005)
aws_autoscaling_group.this: Refreshing state... (ID: zabbix-web-asg-20171127094404350800000006)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
-/+ destroy and then create replacement

Terraform will perform the following actions:

-/+ module.bastion_ec2.aws_instance.this (new resource required)
      id:                                        "i-066ced77fc1428501" => <computed> (forces new resource)
      ami:                                       "ami-e535c59d" => "ami-e535c59d"
      associate_public_ip_address:               "true" => "true"
      availability_zone:                         "us-west-2a" => <computed> (forces new resource)
      disable_api_termination:                   "false" => "false"
      ebs_optimized:                             "false" => "false"
      instance_state:                            "running" => <computed>
      instance_type:                             "t2.nano" => "t2.nano"
      ipv6_address_count:                        "0" => "0"
      key_name:                                  "my-key" => "my-key"
      monitoring:                                "false" => "false"
      network_interface.#:                       "0" => <computed>
      network_interface_id:                      "eni-99d3dfaa" => <computed>
      placement_group:                           "" => <computed>
      primary_network_interface_id:              "eni-99d3dfaa" => <computed>
      private_dns:                               "ip-192-168-128-231.us-west-2.compute.internal" => <computed>
      private_ip:                                "192.168.128.231" => <computed> (forces new resource)
      public_dns:                                "" => <computed>
      public_ip:                                 "35.165.35.243" => <computed>
      root_block_device.#:                       "1" => "0"
      root_block_device.0.delete_on_termination: "false" => "true" (forces new resource)
      security_groups.#:                         "0" => <computed>
      source_dest_check:                         "true" => "true"
      subnet_id:                                 "subnet-66b9cb2e" => "subnet-66b9cb2e"
      tags.%:                                    "5" => "5"
      tags.Environment:                          "stage" => "stage"
      tags.Name:                                 "bastion-1" => "bastion-1"
      tags.Service:                              "bastion" => "bastion"
      tags.Subsystem:                            "sshd" => "sshd"
      tags.Terraform:                            "true" => "true"
      tenancy:                                   "default" => "default"
      user_data:                                 "da39a3ee5e6b4b0d3255bfef95601890afd80709" => "da39a3ee5e6b4b0d3255bfef95601890afd80709"
      volume_tags.%:                             "0" => <computed>
      vpc_security_group_ids.#:                  "2" => "2"
      vpc_security_group_ids.3396590673:         "sg-121ae46e" => "sg-121ae46e"
      vpc_security_group_ids.798409958:          "sg-9e1fe1e2" => "sg-9e1fe1e2"

  ~ module.zabbix_db.module.db_instance.aws_db_instance.this
      license_model:                             "general-public-license" => <computed>


Plan: 1 to add, 1 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.bastion_ec2.aws_instance.this: Destroying... (ID: i-066ced77fc1428501)
module.zabbix_db.module.db_instance.aws_db_instance.this: Modifying... (ID: zabbix-db)
  license_model: "general-public-license" => "<computed>"
module.zabbix_db.module.db_instance.aws_db_instance.this: Modifications complete after 3s (ID: zabbix-db)
module.bastion_ec2.aws_instance.this: Still destroying... (ID: i-066ced77fc1428501, 10s elapsed)
module.bastion_ec2.aws_instance.this: Still destroying... (ID: i-066ced77fc1428501, 20s elapsed)
module.bastion_ec2.aws_instance.this: Destruction complete after 25s

Error: Error applying plan:

1 error(s) occurred:

* module.bastion_ec2.aws_instance.this: aws_instance.this: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.

Please include the following information in your report:

    Terraform Version: 0.11.0
    Resource ID: aws_instance.this
    Mismatch reason: attribute mismatch: root_block_device.0.delete_on_termination
    Diff One (usually from plan): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"root_block_device.0.delete_on_termination":*terraform.ResourceAttrDiff{Old:"false", New:"true", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "monitoring":*terraform.ResourceAttrDiff{Old:"false", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "source_dest_check":*terraform.ResourceAttrDiff{Old:"true", New:"true", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "ami":*terraform.ResourceAttrDiff{Old:"ami-e535c59d", New:"ami-e535c59d", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_security_group_ids.#":*terraform.ResourceAttrDiff{Old:"2", New:"2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.Terraform":*terraform.ResourceAttrDiff{Old:"true", New:"true", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.Name":*terraform.ResourceAttrDiff{Old:"bastion-1", New:"bastion-1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "user_data":*terraform.ResourceAttrDiff{Old:"da39a3ee5e6b4b0d3255bfef95601890afd80709", New:"da39a3ee5e6b4b0d3255bfef95601890afd80709", NewComputed:false, NewRemoved:false, NewExtra:"", RequiresNew:false, Sensitive:false, Type:0x0}, "placement_group":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "private_ip":*terraform.ResourceAttrDiff{Old:"192.168.128.231", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "disable_api_termination":*terraform.ResourceAttrDiff{Old:"false", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "primary_network_interface_id":*terraform.ResourceAttrDiff{Old:"eni-99d3dfaa", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "network_interface_id":*terraform.ResourceAttrDiff{Old:"eni-99d3dfaa", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.Subsystem":*terraform.ResourceAttrDiff{Old:"sshd", New:"sshd", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "ipv6_address_count":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tenancy":*terraform.ResourceAttrDiff{Old:"default", New:"default", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.%":*terraform.ResourceAttrDiff{Old:"5", New:"5", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "public_dns":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.Service":*terraform.ResourceAttrDiff{Old:"bastion", New:"bastion", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "instance_state":*terraform.ResourceAttrDiff{Old:"running", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "root_block_device.#":*terraform.ResourceAttrDiff{Old:"1", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "public_ip":*terraform.ResourceAttrDiff{Old:"35.165.35.243", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.Environment":*terraform.ResourceAttrDiff{Old:"stage", New:"stage", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "key_name":*terraform.ResourceAttrDiff{Old:"my-key", New:"my-key", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "instance_type":*terraform.ResourceAttrDiff{Old:"t2.nano", New:"t2.nano", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_security_group_ids.798409958":*terraform.ResourceAttrDiff{Old:"sg-9e1fe1e2", New:"sg-9e1fe1e2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_security_group_ids.3396590673":*terraform.ResourceAttrDiff{Old:"sg-121ae46e", New:"sg-121ae46e", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "availability_zone":*terraform.ResourceAttrDiff{Old:"us-west-2a", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "associate_public_ip_address":*terraform.ResourceAttrDiff{Old:"true", New:"true", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "network_interface.#":*terraform.ResourceAttrDiff{Old:"0", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "ebs_optimized":*terraform.ResourceAttrDiff{Old:"false", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "security_groups.#":*terraform.ResourceAttrDiff{Old:"0", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "private_dns":*terraform.ResourceAttrDiff{Old:"ip-192-168-128-231.us-west-2.compute.internal", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "subnet_id":*terraform.ResourceAttrDiff{Old:"subnet-66b9cb2e", New:"subnet-66b9cb2e", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "volume_tags.%":*terraform.ResourceAttrDiff{Old:"0", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}
    Diff Two (usually from apply): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"ipv6_address_count":*terraform.ResourceAttrDiff{Old:"", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "source_dest_check":*terraform.ResourceAttrDiff{Old:"", New:"true", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "private_dns":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "instance_type":*terraform.ResourceAttrDiff{Old:"", New:"t2.nano", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "key_name":*terraform.ResourceAttrDiff{Old:"", New:"my-key", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "tags.Name":*terraform.ResourceAttrDiff{Old:"", New:"bastion-1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "network_interface_id":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "ami":*terraform.ResourceAttrDiff{Old:"", New:"ami-e535c59d", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "user_data":*terraform.ResourceAttrDiff{Old:"", New:"da39a3ee5e6b4b0d3255bfef95601890afd80709", NewComputed:false, NewRemoved:false, NewExtra:"", RequiresNew:true, Sensitive:false, Type:0x0}, "vpc_security_group_ids.3396590673":*terraform.ResourceAttrDiff{Old:"", New:"sg-121ae46e", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_security_group_ids.#":*terraform.ResourceAttrDiff{Old:"", New:"2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "primary_network_interface_id":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tenancy":*terraform.ResourceAttrDiff{Old:"", New:"default", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "tags.Service":*terraform.ResourceAttrDiff{Old:"", New:"bastion", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "private_ip":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "public_ip":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.Subsystem":*terraform.ResourceAttrDiff{Old:"", New:"sshd", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "network_interface.#":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "security_groups.#":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "tags.%":*terraform.ResourceAttrDiff{Old:"", New:"5", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "monitoring":*terraform.ResourceAttrDiff{Old:"", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "availability_zone":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "disable_api_termination":*terraform.ResourceAttrDiff{Old:"", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.Terraform":*terraform.ResourceAttrDiff{Old:"", New:"true", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "public_dns":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_security_group_ids.798409958":*terraform.ResourceAttrDiff{Old:"", New:"sg-9e1fe1e2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "placement_group":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "tags.Environment":*terraform.ResourceAttrDiff{Old:"", New:"stage", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "associate_public_ip_address":*terraform.ResourceAttrDiff{Old:"", New:"true", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "volume_tags.%":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "ebs_optimized":*terraform.ResourceAttrDiff{Old:"", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "instance_state":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "subnet_id":*terraform.ResourceAttrDiff{Old:"", New:"subnet-66b9cb2e", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}

Also include as much context as you can about your config, state, and the steps you performed to trigger this error.


Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

terraform version

laptop-A018226:stage dhelios$ terraform -version
Terraform v0.11.0
+ provider.aws v1.3.1
+ provider.template v1.0.0

terraform code
zabbix_ex_v3.zip

@jn9999
Copy link

jn9999 commented Nov 30, 2017

I am not seeing the same error but terraform wants to create a replacement instance for an instance created with this module. No changes made, just running plan and apply again.

@boldandbusted
Copy link

I am seeing what @jn9999 sees: a create/destroy loop. :/

@antonbabenko
Copy link
Member

Sorry for the delay in my response.

From what I see there are at least 4 different arguments which can make this module non-idempotent, which is bad:

  1. vpc_security_group_ids
  2. subnet_id, availability_zone, private_ip - these arguments are optional to allow AWS to create an instance in the default subnet in a default VPC and assign available private IP. It means that this value is not known when Terraform runs and it is marked <computed> (forces new resource).

The problem with vpc_security_group_ids turns out to be in Terraform AWS provider and is rather popular. There are several mentionings:

Proposed solution:

  1. Add private_ip and vpc_security_group_ids to ignore_changes lifecycle.
  2. Require users to set values for subnet_id explicitly (availability_zone value will be set internally using aws_subnet data source).

These changes should make this module idempotent.

Objections? Comments?

PS: It helps to upvote related issues to increase chances of them being prioritized and fixed.

@jn9999
Copy link

jn9999 commented Dec 8, 2017

The proposed solution sounds good to me since I already set the subnet_id explicitly.

@antonbabenko
Copy link
Member

v1.1.0 has been released.

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants