Fix direct variable usage

This commit is contained in:
Tobias Reisinger 2024-09-30 01:26:42 +02:00
parent bae9fe9e0f
commit ed555418e2
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
5 changed files with 37 additions and 37 deletions

34
main.tf
View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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" {

View file

@ -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
}