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 #1353

Closed
hashibot opened this issue Aug 5, 2017 · 4 comments
Closed

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

hashibot opened this issue Aug 5, 2017 · 4 comments
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic.

Comments

@hashibot
Copy link

hashibot commented Aug 5, 2017

This issue was originally opened by @majormoses as hashicorp/terraform#15726. It was migrated here as a result of the provider split. The original body of the issue is below.


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

@hashibot hashibot added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Aug 5, 2017
@majormoses
Copy link

majormoses commented Aug 5, 2017

relevant log portion after upgrade:

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

full log: https://gist.github.com/majormoses/676b95f191730ac64ab574585de7dfca

@radeksimko
Copy link
Member

Hi @majormoses
thanks for this crash report.

I'm marking as duplicate of #1314 which was fixed in #1316 and will be shipped as part of the next release 🔜 .

@radeksimko
Copy link
Member

Duplicate of #1314

@radeksimko radeksimko marked this as a duplicate of #1314 Aug 5, 2017
@ghost
Copy link

ghost commented Apr 11, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic.
Projects
None yet
Development

No branches or pull requests

3 participants