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

Crash with AWS provider creating aws_instance #19167

Closed
rberlind opened this issue Oct 22, 2018 · 8 comments
Closed

Crash with AWS provider creating aws_instance #19167

rberlind opened this issue Oct 22, 2018 · 8 comments
Milestone

Comments

@rberlind
Copy link
Contributor

Terraform Version

$terraform -v
Terraform v0.12.0-alpha1
+ provider.aws v1.40.0-5-g4f24bc8b7

Terraform Configuration Files

terraform {
  required_version = ">= 0.12.0"
}

provider "aws" {
  region = var.aws_region
}

resource "aws_instance" "ubuntu" {
  ami                         = var.ami_id
  instance_type               = var.instance_type
  availability_zone           = format("%sb", var.aws_region)
  associate_public_ip_address = "true"
  tags = {
    Name  = var.name
    owner = "[email protected]"
    ttl   = "-1"
  }
}

Debug Output

https://gist.github.com/rberlind/fbac8ad21e592649e939fa89b8874c6e

Crash Output

https://gist.github.com/rberlind/b5b8dc06fc289725a8a2fe6b0801b3ea

Expected Behavior

Apply should have worked.

Actual Behavior

Crash.

Steps to Reproduce

  1. terraform init
  2. terraform apply

Additional Context

The panic message I saw in the crash ("can't use ElementIterator on null value") is the same as in #19152 even though I used the AWS provider and that issue used the Google provider.

Note that I did use the AWS provider that was bundled with the Terraform 0.12 alpha-1

References

Possibly #19152

@rberlind
Copy link
Contributor Author

I should note that I was able to use the AWS provider to create a VPC with some simple code:

provider "aws" {
  region = "us-east-1"
}

resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
  tags = {
    Name = "roger-test-0.12"
  }
}

@mitchellh
Copy link
Contributor

Noting that this is the same crash as #19152.

@rberlind
Copy link
Contributor Author

Strangely, my AWS example works if I add a credit_specification block at the end:

terraform {
  required_version = ">= 0.12.0"
}

provider "aws" {
  region = var.aws_region
}

resource "aws_instance" "ubuntu" {
  ami           = var.ami_id
  instance_type = var.instance_type
  availability_zone = format("%sb", var.aws_region)
  tags = {
    Name  = var.name
    owner = "[email protected]"
    ttl   = "-1"
  }
  credit_specification {
    cpu_credits = "unlimited"
  }
}

I discovered this accidentally while implementing this example. That example works with either the credit_specification or network_interface block or both of them.

@mitchellh
Copy link
Contributor

I just verified that this is fixed with #19201

@mitchellh
Copy link
Contributor

(Note that it requires a rebuilt AWS provider against an updated Terraform vendor)

@rberlind
Copy link
Contributor Author

Thanks @mitchellh

@apparentlymart apparentlymart modified the milestone: v0.12.0 Oct 29, 2018
@rberlind
Copy link
Contributor Author

I can verify this is fixed in 0.12 alpha-2

@ghost
Copy link

ghost commented Mar 31, 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 Mar 31, 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