Skip to content

Commit

Permalink
Merge pull request #6 from jtopjian/v012
Browse files Browse the repository at this point in the history
v0.12 Support
  • Loading branch information
jtopjian authored May 25, 2019
2 parents 7149a81 + 90ee117 commit 63cc11d
Show file tree
Hide file tree
Showing 12 changed files with 1,317 additions and 290 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/*.swp
**/*.terraform
work
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
CURDIR := $(shell pwd)
TEST?=$$(go list ./... |grep -v 'vendor')
TARGETS=darwin linux
TERRAFORM_VERSION="0.11.13"
TERRAFORM_VERSION_v011="0.11.13"
TERRAFORM_VERSION_v012="0.12.0"

test:
test: test_v011 test_v012

test_v011:
rm -rf work || true
mkdir work ; \
cd work ; \
wget https://releases.hashicorp.com/terraform/$(TERRAFORM_VERSION_v011)/terraform_$(TERRAFORM_VERSION_v011)_linux_amd64.zip ; \
unzip terraform_$(TERRAFORM_VERSION_v011)_linux_amd64.zip
PATH=$(CURDIR)/work:$(PATH) go test -v -run="V011" ./... -count=1

test_v012:
rm -rf work || true
mkdir work ; \
cd work ; \
wget https://releases.hashicorp.com/terraform/$(TERRAFORM_VERSION)/terraform_$(TERRAFORM_VERSION)_linux_amd64.zip ; \
unzip terraform_$(TERRAFORM_VERSION)_linux_amd64.zip
PATH=$(CURDIR)/work:$(PATH) go test -v $(TEST) ./... -count=1
wget https://releases.hashicorp.com/terraform/$(TERRAFORM_VERSION_v012)/terraform_$(TERRAFORM_VERSION_v012)_linux_amd64.zip ; \
unzip terraform_$(TERRAFORM_VERSION_v012)_linux_amd64.zip
PATH=$(CURDIR)/work:$(PATH) go test -v -run "V012" ./... -count=1

build:
go install
Expand Down
45 changes: 42 additions & 3 deletions fixtures/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "ansible_group" "group_1" {
inventory_group_name = "group_1"
children = ["group_2"]

vars {
vars = {
foo = "bar"
}
}
Expand All @@ -11,11 +11,16 @@ resource "ansible_group" "group_2" {
inventory_group_name = "group_2"
}

resource "ansible_group" "other_groups" {
count = 2
inventory_group_name = "some_group_${count.index}"
}

resource "ansible_host" "host_1" {
inventory_hostname = "host_1"
groups = ["group_1"]

vars {
vars = {
ansible_user = "ubuntu"
ansible_host = "1.2.3.4"
test = "host_1"
Expand All @@ -26,9 +31,43 @@ resource "ansible_host" "host_2" {
inventory_hostname = "host_2"
groups = ["group_1"]

vars {
vars = {
ansible_user = "ubuntu"
ansible_host = "1.2.3.5"
test = "host_2"
}
}

resource "ansible_host" "host_3" {
inventory_hostname = "host_3"
groups = ["group_3"]

vars = {
ansible_user = "ubuntu"
ansible_host = "1.2.3.6"
}
}

resource "ansible_host" "host_4" {
inventory_hostname = "host_4"

vars = {
ansible_user = "ubuntu"
ansible_host = "1.2.3.7"
}
}

resource "ansible_host" "other_hosts" {
count = 2
inventory_hostname = "some_host_${count.index}"
groups = ["some_group_${count.index}"]

vars = {
ansible_user = "ubuntu"
ansible_host = "1.2.4.${count.index}"
}
}

module "more_hosts" {
source = "./module"
}
8 changes: 8 additions & 0 deletions fixtures/module/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "ansible_host" "host_5" {
inventory_hostname = "host_5"

vars = {
ansible_user = "ubuntu"
ansible_host = "1.2.3.8"
}
}
109 changes: 103 additions & 6 deletions fixtures/terraform.tfstate → fixtures/v011/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": 3,
"terraform_version": "0.11.1",
"serial": 3,
"lineage": "4da608b9-cfb2-4135-9a02-cb0326eed951",
"terraform_version": "0.11.14",
"serial": 1,
"lineage": "16015fe5-5b24-330c-ca11-e3630a674808",
"modules": [
{
"path": [
Expand Down Expand Up @@ -44,6 +44,36 @@
"deposed": [],
"provider": "provider.ansible"
},
"ansible_group.other_groups.0": {
"type": "ansible_group",
"depends_on": [],
"primary": {
"id": "some_group_0",
"attributes": {
"id": "some_group_0",
"inventory_group_name": "some_group_0"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.ansible"
},
"ansible_group.other_groups.1": {
"type": "ansible_group",
"depends_on": [],
"primary": {
"id": "some_group_1",
"attributes": {
"id": "some_group_1",
"inventory_group_name": "some_group_1"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.ansible"
},
"ansible_host.host_1": {
"type": "ansible_host",
"depends_on": [],
Expand Down Expand Up @@ -96,7 +126,7 @@
"groups.0": "group_3",
"id": "host_3",
"inventory_hostname": "host_3",
"vars.%": "3",
"vars.%": "2",
"vars.ansible_host": "1.2.3.6",
"vars.ansible_user": "ubuntu"
},
Expand All @@ -112,10 +142,9 @@
"primary": {
"id": "host_4",
"attributes": {
"groups.#": "0",
"id": "host_4",
"inventory_hostname": "host_4",
"vars.%": "3",
"vars.%": "2",
"vars.ansible_host": "1.2.3.7",
"vars.ansible_user": "ubuntu"
},
Expand All @@ -124,6 +153,74 @@
},
"deposed": [],
"provider": "provider.ansible"
},
"ansible_host.other_hosts.0": {
"type": "ansible_host",
"depends_on": [],
"primary": {
"id": "some_host_0",
"attributes": {
"groups.#": "1",
"groups.0": "some_group_0",
"id": "some_host_0",
"inventory_hostname": "some_host_0",
"vars.%": "2",
"vars.ansible_host": "1.2.4.0",
"vars.ansible_user": "ubuntu"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.ansible"
},
"ansible_host.other_hosts.1": {
"type": "ansible_host",
"depends_on": [],
"primary": {
"id": "some_host_1",
"attributes": {
"groups.#": "1",
"groups.0": "some_group_1",
"id": "some_host_1",
"inventory_hostname": "some_host_1",
"vars.%": "2",
"vars.ansible_host": "1.2.4.1",
"vars.ansible_user": "ubuntu"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.ansible"
}
},
"depends_on": []
},
{
"path": [
"root",
"more_hosts"
],
"outputs": {},
"resources": {
"ansible_host.host_5": {
"type": "ansible_host",
"depends_on": [],
"primary": {
"id": "host_5",
"attributes": {
"id": "host_5",
"inventory_hostname": "host_5",
"vars.%": "2",
"vars.ansible_host": "1.2.3.8",
"vars.ansible_user": "ubuntu"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.ansible"
}
},
"depends_on": []
Expand Down
Loading

0 comments on commit 63cc11d

Please sign in to comment.