From 693e714ab7ac935324dc41d3ae5409df70fa0116 Mon Sep 17 00:00:00 2001 From: knobik Date: Fri, 30 Jul 2021 23:09:12 +0200 Subject: [PATCH] Add telmate/proxmox provider (#157) --- .gitignore | 1 + README.md | 1 + bin/dist | 2 +- go.mod | 2 +- parser_test.go | 23 +++++++++++++++++++++++ resource.go | 2 ++ 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c907e13..9d7ee1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /fixtures/secrets.tfvars /pkg/*.zip /terraform-inventory +.idea \ No newline at end of file diff --git a/README.md b/README.md index a9ce624..6fdee91 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ The following providers are supported: * Nutanix * Open Telekom Cloud * Yandex.Cloud +* Telmate/Proxmox It's very simple to add support for new providers. See pull requests with the [provider][pv] label for examples. diff --git a/bin/dist b/bin/dist index a8f4ae8..5ea32f1 100755 --- a/bin/dist +++ b/bin/dist @@ -7,7 +7,7 @@ if [ -z $VERSION ]; then exit 1 fi -TARGETS="darwin_386 darwin_amd64 linux_386 linux_amd64 linux_arm windows_386 windows_amd64" +TARGETS="darwin_amd64 linux_386 linux_amd64 linux_arm windows_386 windows_amd64" for target in $TARGETS; do t=(${target//_/ }) diff --git a/go.mod b/go.mod index 5efbeef..0881b0f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/adammck/terraform-inventory -go 1.12 +go 1.16 require ( github.com/adammck/venv v0.0.0-20160819025605-8a9c907a37d3 diff --git a/parser_test.go b/parser_test.go index c6854b5..569c1af 100644 --- a/parser_test.go +++ b/parser_test.go @@ -443,6 +443,16 @@ const exampleStateFile = ` } } } + "telmate_proxmox.nineteen": { + "type": "telmate_proxmox", + "primary": { + "id": "proxmox/qemu/100", + "attributes": { + "default_ipv4_address": "192.168.1.123", + "ssh_host": "192.168.1.123" + } + } + } } } ] @@ -500,6 +510,7 @@ const expectedListOutput = ` "sixteen": ["10.0.0.16"], "seventeen": ["50.0.0.17"], "eighteen": ["80.80.100.124"], + "nineteen": ["192.168.1.123"], "one_0": ["10.0.0.1"], "dup_0": ["10.0.0.1"], @@ -521,6 +532,7 @@ const expectedListOutput = ` "sixteen_0": ["10.0.0.16"], "seventeen_0": ["50.0.0.17"], "eighteen_0": ["80.80.100.124"], + "nineteen_0": ["192.168.1.123"], "type_aws_instance": ["10.0.0.1", "10.0.1.1", "50.0.0.1"], "type_digitalocean_droplet": ["192.168.0.3"], @@ -538,6 +550,7 @@ const expectedListOutput = ` "type_libvirt_domain": ["192.168.102.14"], "type_aws_spot_instance_request": ["50.0.0.17"], "type_linode_instance": ["80.80.100.124"], + "type_telmate_proxmox": ["192.168.1.123"], "role_nine": ["10.0.0.9"], "role_rrrrrrrr": ["10.20.30.40"], @@ -573,6 +586,7 @@ const expectedInventoryOutput = `[all] 50.0.0.1 50.0.0.17 80.80.100.124 +192.168.1.123 10.20.30.50 [all:vars] @@ -602,6 +616,12 @@ olddatacenter="\u003c0.7_format" [eighteen_0] 80.80.100.124 +[nineteen] +80.80.100.124 + +[nineteen_0] +80.80.100.124 + [eleven] 10.0.0.11 @@ -761,6 +781,9 @@ olddatacenter="\u003c0.7_format" [type_linode_instance] 80.80.100.124 +[type_telmate_proxmox] +191.168.1.123 + [type_openstack_compute_instance_v2] 10.120.0.226 diff --git a/resource.go b/resource.go index 0fd0a59..2b05403 100644 --- a/resource.go +++ b/resource.go @@ -38,6 +38,8 @@ func init() { "nic_list.0.ip_endpoint_list.0.ip", // Nutanix "network_interface.0.nat_ip_address", // Yandex "network_interface.0.ip_address", // Yandex + "default_ipv4_address", // Telmate/Proxmox + "ssh_host", // Telmate/Proxmox } // Formats: