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

Plan shows 1 object being created but the plan says 2 #15726

Closed
majormoses opened this issue Aug 4, 2017 · 8 comments
Closed

Plan shows 1 object being created but the plan says 2 #15726

majormoses opened this issue Aug 4, 2017 · 8 comments

Comments

@majormoses
Copy link
Contributor

majormoses commented Aug 4, 2017

Terraform Version

$ terraform --version
Terraform v0.9.11

Terraform Configuration Files

resource "aws_instance" "priv-myservice-green" {
  ami                         = "${var.base_ami_green}"
  availability_zone           = "us-west-2a"
  associate_public_ip_address = false

  # Important: Set to true to prevent accidentally wreaking havoc
  disable_api_termination = true
  instance_type           = "m4.large"
  key_name                = "myenv-us-west-2"
  subnet_id               = "${aws_subnet.myenv-priv-util-a.id}"
  iam_instance_profile    = "myenv-myservice"

  vpc_security_group_ids = [
    "${aws_security_group.myenv-allow_ssh_from_vpn.id}",
    "${aws_security_group.myenv-allow_ssh_from_internal.id}",
    "${aws_security_group.allow_icmp.id}",
    "${aws_security_group.myenv-pub-util.id}",
    "${aws_security_group.myenv-priv-util.id}",
    "${aws_security_group.myenv-myservice.id}",
  ]

  user_data = "env=myenv&role=myservice"

  tags {
    Name        = "myenv-priv-myservice"
    role        = "myservice"
    environment = "myenv"
  }
}

Plan Output

Path: current.plan

+ aws_instance.priv-myservice-green
    ami:                               "ami-03854e63"
    associate_public_ip_address:       "false"
    availability_zone:                 "us-west-2a"
    disable_api_termination:           "true"
    ebs_block_device.#:                "<computed>"
    ephemeral_block_device.#:          "<computed>"
    iam_instance_profile:              "myenv-myservice"
    instance_state:                    "<computed>"
    instance_type:                     "m4.large"
    ipv6_address_count:                "<computed>"
    ipv6_addresses.#:                  "<computed>"
    key_name:                          "myenv-us-west-2"
    network_interface.#:               "<computed>"
    network_interface_id:              "<computed>"
    placement_group:                   "<computed>"
    primary_network_interface_id:      "<computed>"
    private_dns:                       "<computed>"
    private_ip:                        "<computed>"
    public_dns:                        "<computed>"
    public_ip:                         "<computed>"
    root_block_device.#:               "<computed>"
    security_groups.#:                 "<computed>"
    source_dest_check:                 "true"
    subnet_id:                         "subnet-e69ab383"
    tags.%:                            "3"
    tags.Name:                         "myenv-priv-myservice"
    tags.environment:                  "myenv"
    tags.role:                         "myservice"
    tenancy:                           "<computed>"
    user_data:                         "09d16613de7fa7e29ab341c1836f8deac6a114e0"
    volume_tags.%:                     "<computed>"
    vpc_security_group_ids.#:          "6"
    vpc_security_group_ids.1149276164: "sg-ebf0ef8f"
    vpc_security_group_ids.1872102763: "sg-0d397f69"
    vpc_security_group_ids.3295378968: "sg-e683c482"
    vpc_security_group_ids.354108730:  "sg-e783c483"
    vpc_security_group_ids.3965836067: "sg-eaf0ef8e"
    vpc_security_group_ids.78683198:   "sg-0f397f6b"


Plan: 2 to add, 0 to change, 0 to destroy.

Notice how there is only a single resource being shown as added but the plan shows 2. It is certainly possible that this issue is specific to our terraform state file. I am more than happy to provide both the statefile and the full config privately after redacting anything sensitive.

Expected Behavior

As there is only a single resource added both in code and in the plan output except for the end.

Actual Behavior

The number of resources added is magically 2 rather than 1.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan

Important Factoids

Nothing that I can think of. But I am willing to share the statefile and full config on something more secure that is not public. I have never seen this and I have been using terraform for a very long. This is

@tombuildsstuff
Copy link
Contributor

Hey @majormoses

Thanks for opening this issue :)

This issue has been fixed in Terraform 0.10 (and was fixed in #15344) - is it possible to upgrade to Terraform 0.10 and confirm that fixes the issue for you?

Thanks!

@majormoses
Copy link
Contributor Author

@tombuildsstuff I upgraded and got a crash, do you want a different isssue or should I attach the logs here?

@tombuildsstuff
Copy link
Contributor

Hey @majormoses

Sorry to hear that :(

Uploading them onto this issue is fine - once the logs are uploaded I'll re-tag this as crash and one of the Core Devs we'll take a look :)

@tombuildsstuff tombuildsstuff added the waiting-response An issue/pull request is waiting for a response from the community label Aug 4, 2017
@majormoses
Copy link
Contributor Author

@jbardin
Copy link
Member

jbardin commented Aug 4, 2017

The relevant portion of the log:

2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: panic: runtime error: invalid memory address or nil pointer dereference
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x17a1fcf]
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: goroutine 216 [running]:
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsS3BucketRead(0xc42013cc40, 0x1d9b840, 0xc420114000, 0x0, 0x3403ba0)
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket.go:787 +0x1b3f
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc4203b9620, 0xc420540050, 0x1d9b840, 0xc420114000, 0xc4201a75b0, 0xc420546701, 0x1)
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:320 +0x21d
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Refresh(0xc420138000, 0xc420540000, 0xc420540050, 0x7f81288ba4b0, 0x0, 0xc420552078)
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:267 +0x91
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Refresh(0xc420312300, 0xc420552190, 0xc4205529f0, 0x0, 0x0)
2017/08/04 08:29:34 [DEBUG] plugin: terraform-provider-aws_v0.1.3_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:510 +0x4e

@tombuildsstuff tombuildsstuff removed the waiting-response An issue/pull request is waiting for a response from the community label Aug 5, 2017
@tombuildsstuff
Copy link
Contributor

Hey @majormoses

Thanks for posting the crash log, taking a look at it this appears to be an issue with the AWS Provider - as such I'm going to get @hashibot to migrate this issue over to the AWS Provider repo :)

Thanks!

@hashibot
Copy link
Contributor

hashibot commented Aug 5, 2017

This issue has been automatically migrated to hashicorp/terraform-provider-aws#1353 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@ghost
Copy link

ghost commented Apr 8, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants