Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use node_name field in node deletion #16

Merged
merged 1 commit into from
Dec 28, 2019
Merged

Conversation

xunleii
Copy link
Owner

@xunleii xunleii commented Dec 28, 2019

No description provided.

- Because Terraform doesn't allow us to use each.value during a
deletion, we need to cache the node name (inside triggers because I
don't know another trick to do that.
@xunleii xunleii merged commit 0019d8e into master Dec 28, 2019
@xunleii xunleii deleted the fix-use-node-cache branch December 28, 2019 17:35
@github-actions
Copy link
Contributor

terraform plan Success

Show Output

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # hcloud_network.k3s will be created
  + resource "hcloud_network" "k3s" {
      + id       = (known after apply)
      + ip_range = "10.0.0.0/8"
      + name     = "k3s-network"
    }

  # hcloud_network_subnet.k3s_nodes will be created
  + resource "hcloud_network_subnet" "k3s_nodes" {
      + gateway      = (known after apply)
      + id           = (known after apply)
      + ip_range     = "10.254.1.0/24"
      + network_id   = (known after apply)
      + network_zone = "eu-central"
      + type         = "server"
    }

  # hcloud_server.agents[0] will be created
  + resource "hcloud_server" "agents" {
      + backup_window = (known after apply)
      + backups       = false
      + datacenter    = (known after apply)
      + id            = (known after apply)
      + image         = "ubuntu-18.04"
      + ipv4_address  = (known after apply)
      + ipv6_address  = (known after apply)
      + ipv6_network  = (known after apply)
      + keep_disk     = false
      + labels        = {
          + "engine"      = "k3s"
          + "node_type"   = "agent"
          + "provisioner" = "terraform"
        }
      + location      = (known after apply)
      + name          = "k3s-agent-0"
      + server_type   = "cx11-ceph"
      + ssh_keys      = (known after apply)
      + status        = (known after apply)
    }

  # hcloud_server.agents[1] will be created
  + resource "hcloud_server" "agents" {
      + backup_window = (known after apply)
      + backups       = false
      + datacenter    = (known after apply)
      + id            = (known after apply)
      + image         = "ubuntu-18.04"
      + ipv4_address  = (known after apply)
      + ipv6_address  = (known after apply)
      + ipv6_network  = (known after apply)
      + keep_disk     = false
      + labels        = {
          + "engine"      = "k3s"
          + "node_type"   = "agent"
          + "provisioner" = "terraform"
        }
      + location      = (known after apply)
      + name          = "k3s-agent-1"
      + server_type   = "cx11-ceph"
      + ssh_keys      = (known after apply)
      + status        = (known after apply)
    }

  # hcloud_server.agents[2] will be created
  + resource "hcloud_server" "agents" {
      + backup_window = (known after apply)
      + backups       = false
      + datacenter    = (known after apply)
      + id            = (known after apply)
      + image         = "ubuntu-18.04"
      + ipv4_address  = (known after apply)
      + ipv6_address  = (known after apply)
      + ipv6_network  = (known after apply)
      + keep_disk     = false
      + labels        = {
          + "engine"      = "k3s"
          + "node_type"   = "agent"
          + "provisioner" = "terraform"
        }
      + location      = (known after apply)
      + name          = "k3s-agent-2"
      + server_type   = "cx11-ceph"
      + ssh_keys      = (known after apply)
      + status        = (known after apply)
    }

  # hcloud_server.server will be created
  + resource "hcloud_server" "server" {
      + backup_window = (known after apply)
      + backups       = false
      + datacenter    = (known after apply)
      + id            = (known after apply)
      + image         = "ubuntu-18.04"
      + ipv4_address  = (known after apply)
      + ipv6_address  = (known after apply)
      + ipv6_network  = (known after apply)
      + keep_disk     = false
      + labels        = {
          + "engine"      = "k3s"
          + "node_type"   = "server"
          + "provisioner" = "terraform"
        }
      + location      = (known after apply)
      + name          = "k3s-server"
      + server_type   = "cx11-ceph"
      + ssh_keys      = (known after apply)
      + status        = (known after apply)
    }

  # hcloud_server_network.agents_network[0] will be created
  + resource "hcloud_server_network" "agents_network" {
      + id          = (known after apply)
      + ip          = "10.254.1.2"
      + mac_address = (known after apply)
      + network_id  = (known after apply)
      + server_id   = (known after apply)
    }

  # hcloud_server_network.agents_network[1] will be created
  + resource "hcloud_server_network" "agents_network" {
      + id          = (known after apply)
      + ip          = "10.254.1.3"
      + mac_address = (known after apply)
      + network_id  = (known after apply)
      + server_id   = (known after apply)
    }

  # hcloud_server_network.agents_network[2] will be created
  + resource "hcloud_server_network" "agents_network" {
      + id          = (known after apply)
      + ip          = "10.254.1.4"
      + mac_address = (known after apply)
      + network_id  = (known after apply)
      + server_id   = (known after apply)
    }

  # hcloud_server_network.server_network will be created
  + resource "hcloud_server_network" "server_network" {
      + id          = (known after apply)
      + ip          = "10.254.1.1"
      + mac_address = (known after apply)
      + network_id  = (known after apply)
      + server_id   = (known after apply)
    }

  # hcloud_ssh_key.default will be created
  + resource "hcloud_ssh_key" "default" {
      + fingerprint = (known after apply)
      + id          = (known after apply)
      + name        = "K3S terraform module - Provisionning SSH key"
    }

  # module.k3s.null_resource.k3s_agent_cache["k3s-agent-0_node"] will be created
  + resource "null_resource" "k3s_agent_cache" {
      + id       = (known after apply)
      + triggers = {
          + "node_name" = "k3s-agent-0"
        }
    }

  # module.k3s.null_resource.k3s_agent_cache["k3s-agent-1_node"] will be created
  + resource "null_resource" "k3s_agent_cache" {
      + id       = (known after apply)
      + triggers = {
          + "node_name" = "k3s-agent-1"
        }
    }

  # module.k3s.null_resource.k3s_agent_cache["k3s-agent-2_node"] will be created
  + resource "null_resource" "k3s_agent_cache" {
      + id       = (known after apply)
      + triggers = {
          + "node_name" = "k3s-agent-2"
        }
    }

  # module.k3s.null_resource.k3s_agents["k3s-agent-0_node"] will be created
  + resource "null_resource" "k3s_agents" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents["k3s-agent-1_node"] will be created
  + resource "null_resource" "k3s_agents" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents["k3s-agent-2_node"] will be created
  + resource "null_resource" "k3s_agents" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents_installer["k3s-agent-0_node"] will be created
  + resource "null_resource" "k3s_agents_installer" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents_installer["k3s-agent-1_node"] will be created
  + resource "null_resource" "k3s_agents_installer" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents_installer["k3s-agent-2_node"] will be created
  + resource "null_resource" "k3s_agents_installer" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents_uninstaller["k3s-agent-0_node"] will be created
  + resource "null_resource" "k3s_agents_uninstaller" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents_uninstaller["k3s-agent-1_node"] will be created
  + resource "null_resource" "k3s_agents_uninstaller" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_agents_uninstaller["k3s-agent-2_node"] will be created
  + resource "null_resource" "k3s_agents_uninstaller" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_server will be created
  + resource "null_resource" "k3s_server" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.null_resource.k3s_server_installer will be created
  + resource "null_resource" "k3s_server_installer" {
      + id       = (known after apply)
      + triggers = (known after apply)
    }

  # module.k3s.random_password.k3s_cluster_secret will be created
  + resource "random_password" "k3s_cluster_secret" {
      + id          = (known after apply)
      + length      = 48
      + lower       = true
      + min_lower   = 0
      + min_numeric = 0
      + min_special = 0
      + min_upper   = 0
      + number      = true
      + result      = (sensitive value)
      + special     = false
      + upper       = true
    }

Plan: 26 to add, 0 to change, 0 to destroy.

Workflow: Terraform GitHub Actions, Action: hashicorpterraform-github-actions4, Working Directory: examples/hcloud-k3s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant