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

Public IP Never Assigned When Requested in VPC #214

Closed
dan9186 opened this issue Aug 21, 2014 · 7 comments
Closed

Public IP Never Assigned When Requested in VPC #214

dan9186 opened this issue Aug 21, 2014 · 7 comments
Labels

Comments

@dan9186
Copy link

dan9186 commented Aug 21, 2014

When trying to create a new AWS Instance within a VPC, a public IP is never assigned though requested.

variable "access_key" {}
variable "secret_key" {}

provider "aws" {
    access_key = "${var.access_key}"
    secret_key = "${var.secret_key}"
    region = "us-east-1"
}

resource "aws_instance" "example" {
        ami = "ami-76817c1e"
        instance_type = "t2.micro"
        key_name = "devkey.pem"
        subnet_id = "subnet-1234abcd"
        security_groups = ["sg-1234abcd"]
        associate_public_ip_address = true
}
@pearkes pearkes added the bug label Aug 21, 2014
@pearkes
Copy link
Contributor

pearkes commented Aug 21, 2014

Thanks, tagged as a bug!

@dan9186
Copy link
Author

dan9186 commented Aug 22, 2014

Well I tried further to confirm that it was my issue, and turns out it was. I thought I was using the latest release, but wasn't. I've updated, and the problem was resolved.

@mitchellh
Copy link
Contributor

Great to hear! Closing

@seanherron
Copy link
Contributor

@dan9186 I'm experiencing this same issue. Running Terraform v0.2.0.dev (b8b012633c3ed8611d2f58d0ae277da8ea472400). Am I missing something?

@dan9186
Copy link
Author

dan9186 commented Aug 26, 2014

What does the output of your terraform plan look like?

You should see something similar to this

+ aws_instance.example
  ami:                         "" => "ami-76817c1e"
  associate_public_ip_address: "" => "1"
  availability_zone:           "" => "<computed>"
  instance_type:               "" => "t2.micro"
  key_name:                    "" => "dev.pem"
  private_dns:                 "" => "<computed>"
  private_ip:                  "" => "<computed>"
  public_dns:                  "" => "<computed>"
  public_ip:                   "" => "<computed>"
  security_groups.#:           "0" => "1"
  security_groups.0:           "" => "security_groups"
  subnet_id:                   "" => "subnet-154da974"

@seanherron
Copy link
Contributor

+ aws_instance.test
    ami:                         "" => "ami-a0ff23c8"
    associate_public_ip_address: "" => "1"
    availability_zone:           "" => "<computed>"
    instance_type:               "" => "t2.medium"
    key_name:                    "" => "dev.pem"
    private_dns:                 "" => "<computed>"
    private_ip:                  "" => "<computed>"
    public_dns:                  "" => "<computed>"
    public_ip:                   "" => "<computed>"
    security_groups.#:           "0" => "1"
    security_groups.0:           "" => "sg-number"
    subnet_id:                   "" => "subnet-number"

However, the instance is not associated with a public IP unless I add an Elastic IP to it.

@ghost
Copy link

ghost commented Apr 27, 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 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants