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

Resource 'aws_ami_from_instance.manage-ami' does not have attribute 'id' for variable 'aws_ami_from_instance.manage-ami.id' #14450

Closed
haidangwa opened this issue May 12, 2017 · 4 comments

Comments

@haidangwa
Copy link

haidangwa commented May 12, 2017

Terraform Version

0.9.5

Affected Resource(s)

  • aws_ami_from_instance

Terraform Configuration Files

resource "aws_ami_from_instance" "manage-ami" {
  # since the name of the AMI includes a timestamp, this lifecycle rule prevents
  # the resource from being included for every time execution of apply/plan.
  lifecycle {
    ignore_changes = true
  }

  depends_on         = ["null_resource.bootstrap_frontend"]
  name               = "manage-${var.manage_version}-${lower(var.environment)}-${replace(timestamp(), ":", "")}"
  source_instance_id = "${aws_instance.frontends.id}"
}

resource "aws_launch_configuration" "manage" {
  depends_on                  = ["aws_ami_from_instance.manage-ami"]
  name                        = "launch configuration"
  image_id                    = "${aws_ami_from_instance.manage-ami.id}"
  instance_type               = "${var.aws_instance_type["frontend"]}"
  iam_instance_profile        = "sentinel"
  key_name                    = "${var.ssh_key_name}"
  security_groups             = ["sg-000000"]
  associate_public_ip_address = false
}

Expected Behavior

The resource aws_ami_from_instance.manage-ami created a new AMI, so the AMI ID should be exported and usable by other resources.

Actual Behavior

Error running plan: 1 error(s) occurred:

* aws_launch_configuration.manage: 1 error(s) occurred:

* aws_launch_configuration.manage: Resource 'aws_ami_from_instance.manage-ami' does not have attribute 'id' for variable 'aws_ami_from_instance.manage-ami.id'

Steps to Reproduce

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

  1. terraform apply
@apparentlymart
Copy link
Contributor

Hi @haidangwa! Sorry this didn't work properly.

I think this is the same issue being discussed in #5185. In that issue, people reported that the problem went away after re-running terraform apply again. Is that true for you too, or is it persistent no matter how many times you apply?

@haidangwa
Copy link
Author

@apparentlymart Re-running terraform apply makes no difference.

@haidangwa
Copy link
Author

haidangwa commented May 14, 2017

Since we use remote state (S3 backend), I ran terraform state pull after I'd already run terraform destroy and found this:

            "resources": {
                "aws_ami_from_instance.manage-ami": {
                    "type": "aws_ami_from_instance",
                    "depends_on": [],
                    "primary": {
                        "id": "",
                        "attributes": {},
                        "meta": {},
                        "tainted": false
                    },

It appears that the terraform destroy did not remove this from the state file either.

@ghost
Copy link

ghost commented Apr 5, 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 5, 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

3 participants