1
1
mirror of https://github.com/adammck/terraform-inventory synced 2024-11-22 20:01:58 +01:00

Added tags support for Exoscale (#109)

This commit is contained in:
Alexandre 2019-05-12 19:39:40 +02:00 committed by Adam Mckaig
parent 42037e5b2e
commit 2417ce8c1f
2 changed files with 15 additions and 3 deletions

@ -224,12 +224,18 @@ const exampleStateFile = `
"y" "y"
], ],
"primary": { "primary": {
"id": "123456789", "id": "5730e2c9-765f-46e1-aa77-81c94f56ce5d",
"attributes": { "attributes": {
"diskSize": "10", "diskSize": "10",
"id": "123456789", "id": "5730e2c9-765f-46e1-aa77-81c94f56ce5d",
"keypair": "kp", "keypair": "kp",
"name": "xyz", "name": "xyz",
"gateway": "10.0.0.1",
"ip4": "true",
"ip6": "false",
"ip6_address": "",
"ip6_cidr": "",
"ip_address": "10.0.0.9",
"networks.#": "1", "networks.#": "1",
"networks.0.%": "5", "networks.0.%": "5",
"networks.0.default": "true", "networks.0.default": "true",
@ -241,6 +247,8 @@ const exampleStateFile = `
"securitygroups.0": "xyz", "securitygroups.0": "xyz",
"size": "zzz", "size": "zzz",
"state": "Running", "state": "Running",
"tags.%": "1",
"tags.Role": "nine",
"template": "Linux CoreOS stable 1298 64-bit", "template": "Linux CoreOS stable 1298 64-bit",
"userdata": "", "userdata": "",
"zone": "ch-gva-2" "zone": "ch-gva-2"
@ -513,6 +521,7 @@ const expectedListOutput = `
"type_aws_spot_instance_request": ["50.0.0.17"], "type_aws_spot_instance_request": ["50.0.0.17"],
"type_linode_instance": ["80.80.100.124"], "type_linode_instance": ["80.80.100.124"],
"role_nine": ["10.0.0.9"],
"role_rrrrrrrr": ["10.20.30.40"], "role_rrrrrrrr": ["10.20.30.40"],
"role_web": ["10.0.0.1"], "role_web": ["10.0.0.1"],
"role_test": ["10.0.0.10"], "role_test": ["10.0.0.10"],
@ -612,6 +621,9 @@ olddatacenter="\u003c0.7_format"
[one.1] [one.1]
10.0.1.1 10.0.1.1
[role_nine]
10.0.0.9
[role_rrrrrrrr] [role_rrrrrrrr]
10.20.30.40 10.20.30.40

@ -159,7 +159,7 @@ func (r Resource) Tags() map[string]string {
t[vv] = "" t[vv] = ""
} }
} }
case "triton_machine": case "triton_machine", "exoscale_compute":
for k, v := range r.Attributes() { for k, v := range r.Attributes() {
parts := strings.SplitN(k, ".", 2) parts := strings.SplitN(k, ".", 2)
if len(parts) == 2 && parts[0] == "tags" && parts[1] != "%" { if len(parts) == 2 && parts[0] == "tags" && parts[1] != "%" {