From fa8c48d3c5b6e8c3fb685b051b359ee5d258cff5 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Mon, 27 Nov 2017 17:04:29 +0100 Subject: [PATCH] Add Scaleway provider (#80) --- parser_test.go | 46 +++++++++++++++++++++++++++++++++++++++++++++- resource.go | 2 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/parser_test.go b/parser_test.go index d410253..0fa1045 100644 --- a/parser_test.go +++ b/parser_test.go @@ -257,6 +257,32 @@ const exampleStateFile = ` }, "deposed": [], "provider": "" + }, + "scaleway_server.eleven": { + "type": "scaleway_server", + "depends_on": [], + "primary": { + "id": "490c369b-e062-4951-b1c5-f9a8ccee8a38", + "attributes": { + "enable_ipv6": "true", + "id": "490c369b-e062-4951-b1c5-f9a8ccee8a38", + "image": "ab8fbe9e-b13c-46a5-9139-ae7ae73569f0", + "name": "eleven", + "private_ip": "11.0.0.11", + "public_ip": "10.0.0.11", + "public_ipv6": "2001:bc8:4400:2500::e:800", + "security_group": "92a62362-72ab-4864-a94e-f02557153218", + "state": "running", + "state_detail": "booted", + "tags.#": "1", + "tags.0": "scw_test", + "type": "VC1S" + }, + "meta": {}, + "tainted": false + }, + "deposed": [], + "provider": "provider.scaleway" } } } @@ -270,6 +296,7 @@ const expectedListOutput = ` "hosts": [ "10.0.0.1", "10.0.0.10", + "10.0.0.11", "10.0.0.7", "10.0.0.8", "10.0.0.9", @@ -298,6 +325,7 @@ const expectedListOutput = ` "eight": ["10.0.0.8"], "nine": ["10.0.0.9"], "ten": ["10.0.0.10"], + "eleven": ["10.0.0.11"], "one.0": ["10.0.0.1"], "dup.0": ["10.0.0.1"], @@ -311,6 +339,7 @@ const expectedListOutput = ` "eight.0": ["10.0.0.8"], "nine.0": ["10.0.0.9"], "ten.0": ["10.0.0.10"], + "eleven.0": ["10.0.0.11"], "type_aws_instance": ["10.0.0.1", "10.0.1.1", "50.0.0.1"], "type_digitalocean_droplet": ["192.168.0.3"], @@ -321,6 +350,7 @@ const expectedListOutput = ` "type_exoscale_compute": ["10.0.0.9"], "type_google_compute_instance": ["10.0.0.8"], "type_triton_machine": ["10.0.0.10"], + "type_scaleway_server": ["10.0.0.11"], "role_rrrrrrrr": ["10.20.30.40"], "role_web": ["10.0.0.1"], @@ -328,13 +358,15 @@ const expectedListOutput = ` "webserver": ["192.168.0.3"], "staging": ["192.168.0.3"], "status_superserver": ["10.120.0.226"], - "database": ["10.0.0.8"] + "database": ["10.0.0.8"], + "scw_test": ["10.0.0.11"] } ` const expectedInventoryOutput = `[all] 10.0.0.1 10.0.0.10 +10.0.0.11 10.0.0.7 10.0.0.8 10.0.0.9 @@ -366,6 +398,12 @@ olddatacenter="\u003c0.7_format" [eight.0] 10.0.0.8 +[eleven] +10.0.0.11 + +[eleven.0] +10.0.0.11 + [five] 10.20.30.40 @@ -403,6 +441,9 @@ olddatacenter="\u003c0.7_format" [role_web] 10.0.0.1 +[scw_test] +10.0.0.11 + [seven] 10.0.0.7 @@ -459,6 +500,9 @@ olddatacenter="\u003c0.7_format" [type_openstack_compute_instance_v2] 10.120.0.226 +[type_scaleway_server] +10.0.0.11 + [type_softlayer_virtual_guest] 10.0.0.7 diff --git a/resource.go b/resource.go index 56d818c..80d4606 100644 --- a/resource.go +++ b/resource.go @@ -127,7 +127,7 @@ func (r Resource) Tags() map[string]string { t[kk] = vv } } - case "digitalocean_droplet", "google_compute_instance": + case "digitalocean_droplet", "google_compute_instance", "scaleway_server": for k, v := range r.Attributes() { parts := strings.SplitN(k, ".", 2) if len(parts) == 2 && parts[0] == "tags" && parts[1] != "#" {