Skip to content

Commit

Permalink
moved blocks *after* the resource
Browse files Browse the repository at this point in the history
  • Loading branch information
janfrederik committed Nov 15, 2024
1 parent 8db5fe3 commit fa8f286
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 57 deletions.
30 changes: 15 additions & 15 deletions agents.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ locals {
) }
}

moved {
from = null_resource.agent_config
to = terraform_data.agent_config
}
resource "terraform_data" "agent_config" {
for_each = local.agent_nodes

Expand All @@ -89,11 +85,11 @@ resource "terraform_data" "agent_config" {
inline = [local.k3s_config_update_script]
}
}

moved {
from = null_resource.agents
to = terraform_data.agents
from = null_resource.agent_config
to = terraform_data.agent_config
}

resource "terraform_data" "agents" {
for_each = local.agent_nodes

Expand Down Expand Up @@ -136,6 +132,10 @@ resource "terraform_data" "agents" {
hcloud_network_subnet.agent
]
}
moved {
from = null_resource.agents
to = terraform_data.agents
}

resource "hcloud_volume" "longhorn_volume" {
for_each = { for k, v in local.agent_nodes : k => v if((v.longhorn_volume_size >= 10) && (v.longhorn_volume_size <= 10240) && var.enable_longhorn) }
Expand All @@ -153,10 +153,6 @@ resource "hcloud_volume" "longhorn_volume" {
delete_protection = var.enable_delete_protection.volume
}

moved {
from = null_resource.configure_longhorn_volume
to = terraform_data.configure_longhorn_volume
}
resource "terraform_data" "configure_longhorn_volume" {
for_each = { for k, v in local.agent_nodes : k => v if((v.longhorn_volume_size >= 10) && (v.longhorn_volume_size <= 10240) && var.enable_longhorn) }

Expand Down Expand Up @@ -186,6 +182,10 @@ resource "terraform_data" "configure_longhorn_volume" {
hcloud_volume.longhorn_volume
]
}
moved {
from = null_resource.configure_longhorn_volume
to = terraform_data.configure_longhorn_volume
}

resource "hcloud_floating_ip" "agents" {
for_each = { for k, v in local.agent_nodes : k => v if coalesce(lookup(v, "floating_ip"), false) }
Expand All @@ -207,10 +207,6 @@ resource "hcloud_floating_ip_assignment" "agents" {
]
}

moved {
from = null_resource.configure_floating_ip
to = terraform_data.configure_floating_ip
}
resource "terraform_data" "configure_floating_ip" {
for_each = { for k, v in local.agent_nodes : k => v if coalesce(lookup(v, "floating_ip"), false) }

Expand Down Expand Up @@ -250,3 +246,7 @@ resource "terraform_data" "configure_floating_ip" {
hcloud_floating_ip_assignment.agents
]
}
moved {
from = null_resource.configure_floating_ip
to = terraform_data.configure_floating_ip
}
16 changes: 8 additions & 8 deletions autoscaler-agents.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ locals {
}
}

moved {
from = null_resource.configure_autoscaler
to = terraform_data.configure_autoscaler
}
resource "terraform_data" "configure_autoscaler" {
count = length(var.autoscaler_nodepools) > 0 ? 1 : 0

Expand Down Expand Up @@ -89,6 +85,10 @@ resource "terraform_data" "configure_autoscaler" {
data.hcloud_image.microos_x86_snapshot
]
}
moved {
from = null_resource.configure_autoscaler
to = terraform_data.configure_autoscaler
}

data "cloudinit_config" "autoscaler_config" {
count = length(var.autoscaler_nodepools)
Expand Down Expand Up @@ -159,10 +159,6 @@ data "hcloud_servers" "autoscaled_nodes" {
with_selector = "hcloud/node-group=${local.cluster_prefix}${each.value}"
}

moved {
from = null_resource.autoscaled_nodes_registries
to = terraform_data.autoscaled_nodes_registries
}
resource "terraform_data" "autoscaled_nodes_registries" {
for_each = local.autoscaled_nodes
triggers_replace = {
Expand All @@ -186,3 +182,7 @@ resource "terraform_data" "autoscaled_nodes_registries" {
inline = [local.k3s_registries_update_script]
}
}
moved {
from = null_resource.autoscaled_nodes_registries
to = terraform_data.autoscaled_nodes_registries
}
22 changes: 11 additions & 11 deletions control_planes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ locals {
) }
}

moved {
from = null_resource.control_plane_config
to = terraform_data.control_plane_config
}
resource "terraform_data" "control_plane_config" {
for_each = local.control_plane_nodes

Expand Down Expand Up @@ -157,12 +153,12 @@ resource "terraform_data" "control_plane_config" {
hcloud_network_subnet.control_plane
]
}


moved {
from = null_resource.authentication_config
to = terraform_data.authentication_config
from = null_resource.control_plane_config
to = terraform_data.control_plane_config
}


resource "terraform_data" "authentication_config" {
for_each = local.control_plane_nodes

Expand Down Expand Up @@ -193,11 +189,11 @@ resource "terraform_data" "authentication_config" {
hcloud_network_subnet.control_plane
]
}

moved {
from = null_resource.control_planes
to = terraform_data.control_planes
from = null_resource.authentication_config
to = terraform_data.authentication_config
}

resource "terraform_data" "control_planes" {
for_each = local.control_plane_nodes

Expand Down Expand Up @@ -244,3 +240,7 @@ resource "terraform_data" "control_planes" {
hcloud_network_subnet.control_plane
]
}
moved {
from = null_resource.control_planes
to = terraform_data.control_planes
}
16 changes: 8 additions & 8 deletions init.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ resource "hcloud_load_balancer" "cluster" {
}


moved {
from = null_resource.first_control_plane
to = terraform_data.first_control_plane
}
resource "terraform_data" "first_control_plane" {
connection {
user = "root"
Expand Down Expand Up @@ -106,6 +102,10 @@ resource "terraform_data" "first_control_plane" {
hcloud_network_subnet.control_plane
]
}
moved {
from = null_resource.first_control_plane
to = terraform_data.first_control_plane
}

# Needed for rancher setup
resource "random_password" "rancher_bootstrap" {
Expand All @@ -115,10 +115,6 @@ resource "random_password" "rancher_bootstrap" {
}

# This is where all the setup of Kubernetes components happen
moved {
from = null_resource.kustomization
to = terraform_data.kustomization
}
resource "terraform_data" "kustomization" {
triggers_replace = {
# Redeploy helm charts when the underlying values change
Expand Down Expand Up @@ -386,3 +382,7 @@ resource "terraform_data" "kustomization" {
hcloud_volume.longhorn_volume
]
}
moved {
from = null_resource.kustomization
to = terraform_data.kustomization
}
14 changes: 7 additions & 7 deletions kustomization_user.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ locals {
user_kustomization_templates = try(fileset("extra-manifests", "**/*.yaml.tpl"), toset([]))
}

moved {
from = null_resource.kustomization_user
to = terraform_data.kustomization_user
}
resource "terraform_data" "kustomization_user" {
for_each = local.user_kustomization_templates

Expand Down Expand Up @@ -36,11 +32,11 @@ resource "terraform_data" "kustomization_user" {
terraform_data.kustomization
]
}

moved {
from = null_resource.kustomization_user_deploy
to = terraform_data.kustomization_user_deploy
from = null_resource.kustomization_user
to = terraform_data.kustomization_user
}

resource "terraform_data" "kustomization_user_deploy" {
count = length(local.user_kustomization_templates) > 0 ? 1 : 0

Expand Down Expand Up @@ -73,3 +69,7 @@ resource "terraform_data" "kustomization_user_deploy" {
terraform_data.kustomization_user
]
}
moved {
from = null_resource.kustomization_user_deploy
to = terraform_data.kustomization_user_deploy
}
16 changes: 8 additions & 8 deletions modules/host/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ resource "hcloud_server" "server" {

}

moved {
from = null_resource.registries
to = terraform_data.registries
}
resource "terraform_data" "registries" {
triggers_replace = {
registries = var.k3s_registries
Expand All @@ -122,6 +118,10 @@ resource "terraform_data" "registries" {

depends_on = [hcloud_server.server]
}
moved {
from = null_resource.registries
to = terraform_data.registries
}

resource "hcloud_rdns" "server" {
count = var.base_domain != "" ? 1 : 0
Expand Down Expand Up @@ -158,10 +158,6 @@ data "cloudinit_config" "config" {
}
}

moved {
from = null_resource.zram
to = terraform_data.zram
}
resource "terraform_data" "zram" {
triggers_replace = {
zram_size = var.zram_size
Expand Down Expand Up @@ -240,3 +236,7 @@ WantedBy=multi-user.target

depends_on = [hcloud_server.server]
}
moved {
from = null_resource.zram
to = terraform_data.zram
}

0 comments on commit fa8f286

Please sign in to comment.