From c7d942c02b034ce339bdb554e61410d3faa7f5c8 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 30 Oct 2023 19:36:54 +0100 Subject: telegraf-os: Making module. --- terraform/telegraf/conflatorio/ansible-config.yml | 12 --- terraform/telegraf/conflatorio/main.tf | 24 ++--- terraform/telegraf/conflatorio/telegraf.tf | 105 --------------------- .../telegraf/conflatorio/templates/telegraf.conf | 20 ---- terraform/telegraf/telegraf-os/.terraform.lock.hcl | 60 ++++++++++++ terraform/telegraf/telegraf-os/ansible-config.yml | 12 +++ terraform/telegraf/telegraf-os/main.tf | 35 +++++++ terraform/telegraf/telegraf-os/telegraf.tf | 101 ++++++++++++++++++++ .../telegraf/telegraf-os/templates/telegraf.conf | 20 ++++ terraform/telegraf/telegraf-os/vars.tf | 30 ++++++ 10 files changed, 268 insertions(+), 151 deletions(-) delete mode 100644 terraform/telegraf/conflatorio/ansible-config.yml delete mode 100644 terraform/telegraf/conflatorio/telegraf.tf delete mode 100644 terraform/telegraf/conflatorio/templates/telegraf.conf create mode 100644 terraform/telegraf/telegraf-os/.terraform.lock.hcl create mode 100644 terraform/telegraf/telegraf-os/ansible-config.yml create mode 100644 terraform/telegraf/telegraf-os/main.tf create mode 100644 terraform/telegraf/telegraf-os/telegraf.tf create mode 100644 terraform/telegraf/telegraf-os/templates/telegraf.conf create mode 100644 terraform/telegraf/telegraf-os/vars.tf (limited to 'terraform') diff --git a/terraform/telegraf/conflatorio/ansible-config.yml b/terraform/telegraf/conflatorio/ansible-config.yml deleted file mode 100644 index 3acab34..0000000 --- a/terraform/telegraf/conflatorio/ansible-config.yml +++ /dev/null @@ -1,12 +0,0 @@ -- hosts: - - conflatorio - tasks: - - become: yes - file: - state: directory - path: "/etc/trygvis" - - - become: yes - template: - dest: "/etc/trygvis/telegraf.conf" - src: "telegraf.conf" diff --git a/terraform/telegraf/conflatorio/main.tf b/terraform/telegraf/conflatorio/main.tf index 5d94503..1513610 100644 --- a/terraform/telegraf/conflatorio/main.tf +++ b/terraform/telegraf/conflatorio/main.tf @@ -17,21 +17,17 @@ terraform { } } -locals { - ansible_host = "conflatorio" - hostname = "conflatorio.vpn.trygvis.io" - - influx_url = "https://influxdb.vpn.trygvis.io" - influx_token = data.sops_file.vault.data["influx_token"] - influx_organization = "trygvis" - - influx_bucket = "telegraf-lhn2ix" +data "sops_file" "vault" { + source_file = "vault.yml" } -provider "docker" { - host = "ssh://${local.hostname}" -} +module "telegraf-os" { + source = "../telegraf-os" -data "sops_file" "vault" { - source_file = "vault.yml" + docker_gid = 997 + hostname = "conflatorio.vpn.trygvis.io" + ansible_host = "conflatorio" + + influx_token = data.sops_file.vault.data["influx_token"] + influx_bucket = "telegraf-lhn2ix" } diff --git a/terraform/telegraf/conflatorio/telegraf.tf b/terraform/telegraf/conflatorio/telegraf.tf deleted file mode 100644 index 669476a..0000000 --- a/terraform/telegraf/conflatorio/telegraf.tf +++ /dev/null @@ -1,105 +0,0 @@ -#data "docker_network" "public" { -# name = "public" -#} - -data "docker_registry_image" "telegraf" { - name = "telegraf:1.28.3-alpine" -} - -locals { - docker_gid = 997 - entrypoint = <