Skip to content

Showing Terraform outputs as "global" variables#30

Merged
adammck merged 7 commits intoadammck:masterfrom
lazartravica:master
Apr 9, 2016
Merged

Showing Terraform outputs as "global" variables#30
adammck merged 7 commits intoadammck:masterfrom
lazartravica:master

Conversation

@lazartravica
Copy link
Contributor

Outputs specified in the Terraform file are passed to the Ansible dynamic inventory JSON accessible to all hosts.

@adammck
Copy link
Owner

adammck commented Feb 18, 2016

Good idea, thanks for submitting this. Would you mind adding a test case to parser_test.go? (I know it's strange that all of the tests are in there; I intend to split them up.) I'd like to be sure that I understand what's going on here.

@adammck adammck mentioned this pull request Mar 1, 2016
@lazartravica
Copy link
Contributor Author

Hey @adammck , I've commited the parser test.

@lazartravica
Copy link
Contributor Author

@adammck Fixed the compatibility issue with the #31, able to merge 👍

@adammck
Copy link
Owner

adammck commented Apr 9, 2016

Looks good to me:

adammck@imac5k [git df49397] 
~/code/src/github.com/lazartravica/terraform-inventory$ TF_STATE=fixtures/example.tfstate terraform-inventory --list | jq .
{
  "all": {
    "datacenter": "mydc"
  },
  "alpha": [
    "52.90.134.71",
    "52.90.154.150"
  ],
  "alpha.0": [
    "52.90.134.71"
  ],
  "alpha.1": [
    "52.90.154.150"
  ],
  "beta": [
    "52.23.224.202"
  ],
  "beta.0": [
    "52.23.224.202"
  ],
  "gamma": [
    "198.211.99.194"
  ],
  "gamma.0": [
    "198.211.99.194"
  ],
  "role_web": [
    "52.90.134.71",
    "52.90.154.150"
  ],
  "role_worker": [
    "52.23.224.202"
  ],
  "type_aws_instance": [
    "52.90.134.71",
    "52.90.154.150",
    "52.23.224.202"
  ],
  "type_digitalocean_droplet": [
    "198.211.99.194"
  ]
}

This is fantastic, thank you!

@adammck adammck merged commit 9debcb4 into adammck:master Apr 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants