From 2417ce8c1fa82080f2b30ec95972c431e734a3ee Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sun, 12 May 2019 19:39:40 +0200 Subject: [PATCH] Added tags support for Exoscale (#109) --- parser_test.go | 16 ++++++++++++++-- resource.go | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/parser_test.go b/parser_test.go index 1052ce4..5b908bc 100644 --- a/parser_test.go +++ b/parser_test.go @@ -224,12 +224,18 @@ const exampleStateFile = ` "y" ], "primary": { - "id": "123456789", + "id": "5730e2c9-765f-46e1-aa77-81c94f56ce5d", "attributes": { "diskSize": "10", - "id": "123456789", + "id": "5730e2c9-765f-46e1-aa77-81c94f56ce5d", "keypair": "kp", "name": "xyz", + "gateway": "10.0.0.1", + "ip4": "true", + "ip6": "false", + "ip6_address": "", + "ip6_cidr": "", + "ip_address": "10.0.0.9", "networks.#": "1", "networks.0.%": "5", "networks.0.default": "true", @@ -241,6 +247,8 @@ const exampleStateFile = ` "securitygroups.0": "xyz", "size": "zzz", "state": "Running", + "tags.%": "1", + "tags.Role": "nine", "template": "Linux CoreOS stable 1298 64-bit", "userdata": "", "zone": "ch-gva-2" @@ -513,6 +521,7 @@ const expectedListOutput = ` "type_aws_spot_instance_request": ["50.0.0.17"], "type_linode_instance": ["80.80.100.124"], + "role_nine": ["10.0.0.9"], "role_rrrrrrrr": ["10.20.30.40"], "role_web": ["10.0.0.1"], "role_test": ["10.0.0.10"], @@ -612,6 +621,9 @@ olddatacenter="\u003c0.7_format" [one.1] 10.0.1.1 +[role_nine] +10.0.0.9 + [role_rrrrrrrr] 10.20.30.40 diff --git a/resource.go b/resource.go index 687d6b3..877b093 100644 --- a/resource.go +++ b/resource.go @@ -159,7 +159,7 @@ func (r Resource) Tags() map[string]string { t[vv] = "" } } - case "triton_machine": + case "triton_machine", "exoscale_compute": for k, v := range r.Attributes() { parts := strings.SplitN(k, ".", 2) if len(parts) == 2 && parts[0] == "tags" && parts[1] != "%" {