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

Attribute lookups inside variables are not fully processed #180

Closed
sparkprime opened this issue Aug 11, 2014 · 2 comments
Closed

Attribute lookups inside variables are not fully processed #180

sparkprime opened this issue Aug 11, 2014 · 2 comments
Labels

Comments

@sparkprime
Copy link
Contributor

The following script does not deploy correctly because ${aws_security_group.terraform_example.name} is not expanded into "terraform_example" and additionally there is no dependency created between the instance and security group.

{
   "variable": {
       "foo": { "default": "${aws_security_group.terraform_example.name}" }
   },
   "provider": {
      "aws": {
         "access_key": "foo",
         "region": "us-west-2",
         "secret_key": "bar"
      }
   },
   "resource": {
    "aws_instance": {
         "web": {
            "ami": "ami-21f78e11",
            "connection": {
               "key_file": "../terraformkp.pem",
               "user": "ubuntu"
            },
            "instance_type": "m1.small",
            "key_name": "terraformkp",
            "provisioner": {
               "remote-exec": {
                  "inline": [
                     "sudo apt-get -y update",
                     "sudo apt-get -y install nginx",
                     "sudo service nginx start"
                  ]
               }
            },
            "security_groups": [
               "${var.foo}"
            ]
         }
      },
      "aws_security_group": {
         "terraform_example": {
            "description": "Used in the terraform",
            "ingress": {
               "cidr_blocks": [
                  "0.0.0.0/0"
               ],
               "from_port": 22,
               "protocol": "tcp",
               "to_port": 80
            },
            "name": "terraform_example"
         }
      }
   }
}
@mitchellh
Copy link
Contributor

This should result in a validation error (it isn't allowed).

Thanks!

@mitchellh
Copy link
Contributor

Fixed

@ghost ghost locked and limited conversation to collaborators May 5, 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

2 participants