From ed555418e29d9b41b86a49e178e7cebdbc09397c Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Mon, 30 Sep 2024 01:26:42 +0200 Subject: [PATCH] Fix direct variable usage --- main.tf | 34 +++++++++++++++--------------- modules/infrastructure/hcloud.tf | 6 +++--- modules/infrastructure/main.tf | 20 +++++++++--------- modules/infrastructure/scaleway.tf | 2 +- modules/services/main.tf | 12 +++++------ 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/main.tf b/main.tf index c12e260..2e84b0a 100644 --- a/main.tf +++ b/main.tf @@ -21,13 +21,13 @@ terraform { module "services" { source = "./modules/services" - authentik_url = "${var.authentik_url}" - authentik_token = "${var.authentik_token}" + authentik_url = var.authentik_url + authentik_token = var.authentik_token - postgresql_host = "${var.postgresql_host}" - postgresql_port = "${var.postgresql_port}" - postgresql_username = "${var.postgresql_username}" - postgresql_password = "${var.postgresql_password}" + postgresql_host = var.postgresql_host + postgresql_port = var.postgresql_port + postgresql_username = var.postgresql_username + postgresql_password = var.postgresql_password services = var.services } @@ -35,21 +35,21 @@ module "services" { module "infrastructure" { source = "./modules/infrastructure" - hcloud_token = "${var.hcloud_token}" + hcloud_token = var.hcloud_token - ovh_application_key = "${var.ovh_application_key}" - ovh_application_secret = "${var.ovh_application_secret}" - ovh_consumer_key = "${var.ovh_consumer_key}" + ovh_application_key = var.ovh_application_key + ovh_application_secret = var.ovh_application_secret + ovh_consumer_key = var.ovh_consumer_key - scaleway_access_key = "${var.scaleway_access_key}" - scaleway_secret_key = "${var.scaleway_secret_key}" - scaleway_project_id = "${var.scaleway_project_id}" - scaleway_organization_id = "${var.scaleway_organization_id}" + scaleway_access_key = var.scaleway_access_key + scaleway_secret_key = var.scaleway_secret_key + scaleway_project_id = var.scaleway_project_id + scaleway_organization_id = var.scaleway_organization_id - tailscale_api_key = "${var.tailscale_api_key}" - tailscale_tailnet = "${var.tailscale_tailnet}" + tailscale_api_key = var.tailscale_api_key + tailscale_tailnet = var.tailscale_tailnet - default_ssh_key = "${var.default_ssh_key}" + default_ssh_key = var.default_ssh_key hosts = var.hosts services = var.services diff --git a/modules/infrastructure/hcloud.tf b/modules/infrastructure/hcloud.tf index d3aa736..e64c0f3 100644 --- a/modules/infrastructure/hcloud.tf +++ b/modules/infrastructure/hcloud.tf @@ -4,10 +4,10 @@ resource "hcloud_ssh_key" "default" { } data "template_file" "cloud_init" { - template = "${file("./tf-templates/cloud-init.yaml.tpl")}" + template = file("./tf-templates/cloud-init.yaml.tpl") vars = { - tailscale_authkey = "${tailscale_tailnet_key.cloud_init_key.key}" + tailscale_authkey = tailscale_tailnet_key.cloud_init_key.key default_ssh_key = var.default_ssh_key.public_key } } @@ -42,7 +42,7 @@ resource "hcloud_server" "nodes" { image = each.value.image server_type = each.value.server_type ssh_keys = [hcloud_ssh_key.default.id] - user_data = "${data.template_file.cloud_init.rendered}" + user_data = data.template_file.cloud_init.rendered public_net { ipv4 = hcloud_primary_ip.node_ipv4_addresses[each.key].id ipv6 = hcloud_primary_ip.node_ipv6_addresses[each.key].id diff --git a/modules/infrastructure/main.tf b/modules/infrastructure/main.tf index d3d2c41..a63eab8 100644 --- a/modules/infrastructure/main.tf +++ b/modules/infrastructure/main.tf @@ -21,28 +21,28 @@ terraform { provider "hcloud" { - token = "${var.hcloud_token}" + token = var.hcloud_token } provider "ovh" { endpoint = "ovh-eu" - application_key = "${var.ovh_application_key}" - application_secret = "${var.ovh_application_secret}" - consumer_key = "${var.ovh_consumer_key}" + application_key = var.ovh_application_key + application_secret = var.ovh_application_secret + consumer_key = var.ovh_consumer_key } provider "scaleway" { - organization_id = "${var.scaleway_organization_id}" - project_id = "${var.scaleway_project_id}" - access_key = "${var.scaleway_access_key}" - secret_key = "${var.scaleway_secret_key}" + organization_id = var.scaleway_organization_id + project_id = var.scaleway_project_id + access_key = var.scaleway_access_key + secret_key = var.scaleway_secret_key region = "nl-ams" zone = "nl-ams-1" } provider "tailscale" { - api_key = "${var.tailscale_api_key}" - tailnet = "${var.tailscale_tailnet}" + api_key = var.tailscale_api_key + tailnet = var.tailscale_tailnet } diff --git a/modules/infrastructure/scaleway.tf b/modules/infrastructure/scaleway.tf index 5d70bc6..d863c9d 100644 --- a/modules/infrastructure/scaleway.tf +++ b/modules/infrastructure/scaleway.tf @@ -1,5 +1,5 @@ data "scaleway_account_project" "project" { - project_id = "${var.scaleway_project_id}" + project_id = var.scaleway_project_id } resource "scaleway_account_ssh_key" "default" { diff --git a/modules/services/main.tf b/modules/services/main.tf index 03a055f..3185365 100644 --- a/modules/services/main.tf +++ b/modules/services/main.tf @@ -12,16 +12,16 @@ terraform { } provider "authentik" { - url = "${var.authentik_url}" - token = "${var.authentik_token}" + url = var.authentik_url + token = var.authentik_token } provider "postgresql" { - host = "${var.postgresql_host}" - port = "${var.postgresql_port}" + host = var.postgresql_host + port = var.postgresql_port database = "postgres" - username = "${var.postgresql_username}" - password = "${var.postgresql_password}" + username = var.postgresql_username + password = var.postgresql_password sslmode = "verify-full" connect_timeout = 15 }