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

Add pihole #32

Merged
merged 3 commits into from
Nov 17, 2024
Merged

Add pihole #32

merged 3 commits into from
Nov 17, 2024

Conversation

mrsimonemms
Copy link
Owner

Description

Related Issue(s)

Fixes #

How to test

As we're using MetalLB, there's no need for this to be available
Copy link

Execution result of "run-all plan" in "stacks/prod"
time=2024-11-17T16:42:14Z level=info msg=The stack at /github/workspace/stacks/prod will be processed in the following order for command plan:
Group 1
- Module /github/workspace/stacks/prod/hetzner

Group 2
- Module /github/workspace/stacks/prod/kubernetes


time=2024-11-17T16:42:14Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/hetzner into /github/workspace/stacks/prod/hetzner/.terragrunt-cache/7n5v_ZVOv4gLIvn-SLBHuU7F7OI/B-HSI5LUu0nLTnyopQYP4SLEkoU prefix=[/github/workspace/stacks/prod/hetzner] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing modules...
Downloading git::https://github.com/mrsimonemms/terraform-module-k3s.git for k3s...
- k3s in .terraform/modules/k3s
Initializing provider plugins...
- Reusing previous version of hashicorp/local from the dependency lock file
- Reusing previous version of loafoe/ssh from the dependency lock file
- Reusing previous version of hetznercloud/hcloud from the dependency lock file
- Installing hashicorp/local v2.5.1...
- Installed hashicorp/local v2.5.1 (signed by HashiCorp)
- Installing loafoe/ssh v2.7.0...
- Installed loafoe/ssh v2.7.0 (self-signed, key ID C0E4EB79E9E6A23D)
- Installing hetznercloud/hcloud v1.48.0...
- Installed hetznercloud/hcloud v1.48.0 (signed by a HashiCorp partner, key ID 5219EACB3A77198B)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has been successfully initialized!
hcloud_network.network: Refreshing state... [id=10359702]
hcloud_ssh_key.server: Refreshing state... [id=24629412]
hcloud_placement_group.workers["pool1"]: Refreshing state... [id=421156]
hcloud_network_subnet.subnet: Refreshing state... [id=10359702-10.0.0.0/16]
hcloud_server.workers[0]: Refreshing state... [id=55742953]
hcloud_server.workers[1]: Refreshing state... [id=55742955]
hcloud_firewall.firewall: Refreshing state... [id=1740667]
hcloud_server.manager[0]: Refreshing state... [id=55742954]
ssh_resource.workers_ready[0]: Refreshing state... [id=8802200626328928235]
ssh_resource.workers_ready[1]: Refreshing state... [id=3929059511596064850]
ssh_resource.manager_ready[0]: Refreshing state... [id=2259762647014294198]
module.k3s.ssh_resource.initial_manager: Refreshing state... [id=1257207361098552077]
module.k3s.ssh_sensitive_resource.join_token: Refreshing state... [id=1118133096612813927]
module.k3s.ssh_sensitive_resource.kubeconfig: Refreshing state... [id=4284976079349531178]
local_sensitive_file.kubeconfig: Refreshing state... [id=5c26d8c02492f0b93e0a65ff2a9e6383abbe8195]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-0"]: Refreshing state... [id=6622661333265324505]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-1"]: Refreshing state... [id=8991009740447318170]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-0"]: Refreshing state... [id=1344319781362143294]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-1"]: Refreshing state... [id=5286355072201017129]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # hcloud_firewall.firewall will be updated in-place
  ~ resource "hcloud_firewall" "firewall" {
        id     = "1740667"
        name   = "prod-k3s-firewall"
        # (1 unchanged attribute hidden)

      - rule {
          - description     = "Allow ICMP (ping)" -> null
          - destination_ips = [] -> null
          - direction       = "in" -> null
          - protocol        = "icmp" -> null
          - source_ips      = [
              - "0.0.0.0/0",
              - "::/0",
            ] -> null
            # (1 unchanged attribute hidden)
        }
      + rule {
          + description     = "Allow ICMP (ping)"
          + destination_ips = []
          + direction       = "in"
          + protocol        = "icmp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS TCP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "tcp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS TCP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "udp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }

        # (12 unchanged blocks hidden)
    }

  # local_sensitive_file.kubeconfig will be created
  + resource "local_sensitive_file" "kubeconfig" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0755"
      + file_permission      = "0600"
      + filename             = "/github/workspace/.kubeconfig"
      + id                   = (known after apply)
    }

Plan: 1 to add, 1 to change, 0 to destroy.
time=2024-11-17T16:42:26Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/kubernetes into /github/workspace/stacks/prod/kubernetes/.terragrunt-cache/-HGVTuUtXSFDQCN7IIesL6CulRY/z4vfL_CY3720zQ-fo9fFtb8YbxA prefix=[/github/workspace/stacks/prod/kubernetes] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of hashicorp/helm from the dependency lock file
- Reusing previous version of hashicorp/kubernetes from the dependency lock file
- Installing hashicorp/helm v2.14.1...
- Installed hashicorp/helm v2.14.1 (signed by HashiCorp)
- Installing hashicorp/kubernetes v2.31.0...
- Installed hashicorp/kubernetes v2.31.0 (signed by HashiCorp)
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.

Terraform has been successfully initialized!
kubernetes_namespace_v1.external_secrets: Refreshing state... [id=external-secrets]
kubernetes_namespace_v1.metallb: Refreshing state... [id=metallb-system]
kubernetes_namespace_v1.argocd: Refreshing state... [id=argocd]
kubernetes_secret_v1.hcloud: Refreshing state... [id=kube-system/hcloud]
kubernetes_secret_v1.github_secret: Refreshing state... [id=argocd/github-oidc]
kubernetes_secret_v1.infisical: Refreshing state... [id=external-secrets/infisical]
helm_release.hcloud_csi: Refreshing state... [id=hcsi]
helm_release.hcloud_ccm: Refreshing state... [id=hccm]
helm_release.argocd: Refreshing state... [id=argocd]
kubernetes_config_map_v1.metallb: Refreshing state... [id=metallb-system/nodes]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # data.kubernetes_nodes.cluster will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "kubernetes_nodes" "cluster" {
      + id    = (known after apply)
      + nodes = (known after apply)
    }

  # helm_release.hcloud_ccm will be updated in-place
  ~ resource "helm_release" "hcloud_ccm" {
        id                         = "hccm"
      ~ metadata                   = [
          - {
              - chart          = "hcloud-cloud-controller-manager"
              - first_deployed = 1731778592
              - last_deployed  = 1731778592
              - name           = "hccm"
              - namespace      = "kube-system"
              - notes          = <<-EOT
                    
                EOT
              - revision       = 1
              - values         = jsonencode(
                    {
                      - networking     = {
                          - clusterCIDR = "10.42.0.0/16"
                          - enabled     = true
                        }
                      - podAnnotations = {
                          - secret = "bd1881f1cb3b873dbd189e2b34b83e5c65f6cd6252e3fce66d8c06ef65f09b06a6bac702f7f4ab13270b36cae104cf2cd76b6480a327fe10b57b054f7ec90813"
                        }
                    }
                )
              - version        = "1.20.0"
                # (1 unchanged attribute hidden)
            },
        ] -> (known after apply)
        name                       = "hccm"
      + values                     = [
          + <<-EOT
                networking:
                  enabled: true
                
                env:
                  HCLOUD_LOAD_BALANCERS_ENABLED:
                    value: "false"
            EOT,
        ]
        # (26 unchanged attributes hidden)

      - set {
          # At least one attribute in this block is (or was) sensitive,
          # so its contents will not be displayed.
        }

        # (2 unchanged blocks hidden)
    }

  # kubernetes_config_map_v1.metallb will be updated in-place
  ~ resource "kubernetes_config_map_v1" "metallb" {
      ~ data        = {
          - "resource" = <<-EOT
                "apiVersion": "metallb.io/v1beta1"
                "kind": "IPAddressPool"
                "metadata":
                  "name": "nodes"
                  "namespace": "metallb-system"
                "spec":
                  "addresses":
                  - "5.75.184.75/32"
            EOT
        } -> (known after apply)
        id          = "metallb-system/nodes"
        # (2 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

Copy link

Execution result of "run-all plan" in "stacks/prod"
time=2024-11-17T16:43:05Z level=info msg=The stack at /github/workspace/stacks/prod will be processed in the following order for command plan:
Group 1
- Module /github/workspace/stacks/prod/hetzner

Group 2
- Module /github/workspace/stacks/prod/kubernetes


time=2024-11-17T16:43:05Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/hetzner into /github/workspace/stacks/prod/hetzner/.terragrunt-cache/7n5v_ZVOv4gLIvn-SLBHuU7F7OI/B-HSI5LUu0nLTnyopQYP4SLEkoU prefix=[/github/workspace/stacks/prod/hetzner] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing modules...
Downloading git::https://github.com/mrsimonemms/terraform-module-k3s.git for k3s...
- k3s in .terraform/modules/k3s
Initializing provider plugins...
- Reusing previous version of loafoe/ssh from the dependency lock file
- Reusing previous version of hetznercloud/hcloud from the dependency lock file
- Reusing previous version of hashicorp/local from the dependency lock file
- Installing loafoe/ssh v2.7.0...
- Installed loafoe/ssh v2.7.0 (self-signed, key ID C0E4EB79E9E6A23D)
- Installing hetznercloud/hcloud v1.48.0...
- Installed hetznercloud/hcloud v1.48.0 (signed by a HashiCorp partner, key ID 5219EACB3A77198B)
- Installing hashicorp/local v2.5.1...
- Installed hashicorp/local v2.5.1 (signed by HashiCorp)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has been successfully initialized!
hcloud_ssh_key.server: Refreshing state... [id=24629412]
hcloud_network.network: Refreshing state... [id=10359702]
hcloud_placement_group.workers["pool1"]: Refreshing state... [id=421156]
hcloud_network_subnet.subnet: Refreshing state... [id=10359702-10.0.0.0/16]
hcloud_server.workers[0]: Refreshing state... [id=55742953]
hcloud_server.workers[1]: Refreshing state... [id=55742955]
hcloud_firewall.firewall: Refreshing state... [id=1740667]
hcloud_server.manager[0]: Refreshing state... [id=55742954]
ssh_resource.workers_ready[0]: Refreshing state... [id=8802200626328928235]
ssh_resource.workers_ready[1]: Refreshing state... [id=3929059511596064850]
ssh_resource.manager_ready[0]: Refreshing state... [id=2259762647014294198]
module.k3s.ssh_resource.initial_manager: Refreshing state... [id=1257207361098552077]
module.k3s.ssh_sensitive_resource.join_token: Refreshing state... [id=1118133096612813927]
module.k3s.ssh_sensitive_resource.kubeconfig: Refreshing state... [id=4284976079349531178]
local_sensitive_file.kubeconfig: Refreshing state... [id=5c26d8c02492f0b93e0a65ff2a9e6383abbe8195]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-1"]: Refreshing state... [id=8991009740447318170]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-0"]: Refreshing state... [id=6622661333265324505]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-0"]: Refreshing state... [id=1344319781362143294]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-1"]: Refreshing state... [id=5286355072201017129]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # hcloud_firewall.firewall will be updated in-place
  ~ resource "hcloud_firewall" "firewall" {
        id     = "1740667"
        name   = "prod-k3s-firewall"
        # (1 unchanged attribute hidden)

      - rule {
          - description     = "Allow ICMP (ping)" -> null
          - destination_ips = [] -> null
          - direction       = "in" -> null
          - protocol        = "icmp" -> null
          - source_ips      = [
              - "0.0.0.0/0",
              - "::/0",
            ] -> null
            # (1 unchanged attribute hidden)
        }
      + rule {
          + description     = "Allow ICMP (ping)"
          + destination_ips = []
          + direction       = "in"
          + protocol        = "icmp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS TCP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "tcp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS TCP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "udp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }

        # (12 unchanged blocks hidden)
    }

  # local_sensitive_file.kubeconfig will be created
  + resource "local_sensitive_file" "kubeconfig" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0755"
      + file_permission      = "0600"
      + filename             = "/github/workspace/.kubeconfig"
      + id                   = (known after apply)
    }

Plan: 1 to add, 1 to change, 0 to destroy.
time=2024-11-17T16:43:18Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/kubernetes into /github/workspace/stacks/prod/kubernetes/.terragrunt-cache/-HGVTuUtXSFDQCN7IIesL6CulRY/z4vfL_CY3720zQ-fo9fFtb8YbxA prefix=[/github/workspace/stacks/prod/kubernetes] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of hashicorp/kubernetes from the dependency lock file
- Reusing previous version of hashicorp/helm from the dependency lock file
- Installing hashicorp/kubernetes v2.31.0...
- Installed hashicorp/kubernetes v2.31.0 (signed by HashiCorp)
- Installing hashicorp/helm v2.14.1...
- Installed hashicorp/helm v2.14.1 (signed by HashiCorp)
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.

Terraform has been successfully initialized!
kubernetes_namespace_v1.argocd: Refreshing state... [id=argocd]
kubernetes_namespace_v1.metallb: Refreshing state... [id=metallb-system]
kubernetes_secret_v1.hcloud: Refreshing state... [id=kube-system/hcloud]
kubernetes_namespace_v1.external_secrets: Refreshing state... [id=external-secrets]
kubernetes_secret_v1.github_secret: Refreshing state... [id=argocd/github-oidc]
kubernetes_secret_v1.infisical: Refreshing state... [id=external-secrets/infisical]
helm_release.hcloud_ccm: Refreshing state... [id=hccm]
helm_release.hcloud_csi: Refreshing state... [id=hcsi]
helm_release.argocd: Refreshing state... [id=argocd]
kubernetes_config_map_v1.metallb: Refreshing state... [id=metallb-system/nodes]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # data.kubernetes_nodes.cluster will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "kubernetes_nodes" "cluster" {
      + id    = (known after apply)
      + nodes = (known after apply)
    }

  # helm_release.hcloud_ccm will be updated in-place
  ~ resource "helm_release" "hcloud_ccm" {
        id                         = "hccm"
      ~ metadata                   = [
          - {
              - chart          = "hcloud-cloud-controller-manager"
              - first_deployed = 1731778592
              - last_deployed  = 1731778592
              - name           = "hccm"
              - namespace      = "kube-system"
              - notes          = <<-EOT
                    
                EOT
              - revision       = 1
              - values         = jsonencode(
                    {
                      - networking     = {
                          - clusterCIDR = "10.42.0.0/16"
                          - enabled     = true
                        }
                      - podAnnotations = {
                          - secret = "bd1881f1cb3b873dbd189e2b34b83e5c65f6cd6252e3fce66d8c06ef65f09b06a6bac702f7f4ab13270b36cae104cf2cd76b6480a327fe10b57b054f7ec90813"
                        }
                    }
                )
              - version        = "1.20.0"
                # (1 unchanged attribute hidden)
            },
        ] -> (known after apply)
        name                       = "hccm"
      + values                     = [
          + <<-EOT
                networking:
                  enabled: true
                
                env:
                  HCLOUD_LOAD_BALANCERS_ENABLED:
                    value: "false"
            EOT,
        ]
        # (26 unchanged attributes hidden)

      - set {
          # At least one attribute in this block is (or was) sensitive,
          # so its contents will not be displayed.
        }

        # (2 unchanged blocks hidden)
    }

  # kubernetes_config_map_v1.metallb will be updated in-place
  ~ resource "kubernetes_config_map_v1" "metallb" {
      ~ data        = {
          - "resource" = <<-EOT
                "apiVersion": "metallb.io/v1beta1"
                "kind": "IPAddressPool"
                "metadata":
                  "name": "nodes"
                  "namespace": "metallb-system"
                "spec":
                  "addresses":
                  - "5.75.184.75/32"
            EOT
        } -> (known after apply)
        id          = "metallb-system/nodes"
        # (2 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

Copy link

Execution result of "run-all plan" in "stacks/prod"
time=2024-11-17T16:44:35Z level=info msg=The stack at /github/workspace/stacks/prod will be processed in the following order for command plan:
Group 1
- Module /github/workspace/stacks/prod/hetzner

Group 2
- Module /github/workspace/stacks/prod/kubernetes


time=2024-11-17T16:44:35Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/hetzner into /github/workspace/stacks/prod/hetzner/.terragrunt-cache/7n5v_ZVOv4gLIvn-SLBHuU7F7OI/B-HSI5LUu0nLTnyopQYP4SLEkoU prefix=[/github/workspace/stacks/prod/hetzner] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing modules...
Downloading git::https://github.com/mrsimonemms/terraform-module-k3s.git for k3s...
- k3s in .terraform/modules/k3s
Initializing provider plugins...
- Reusing previous version of hetznercloud/hcloud from the dependency lock file
- Reusing previous version of hashicorp/local from the dependency lock file
- Reusing previous version of loafoe/ssh from the dependency lock file
- Installing hetznercloud/hcloud v1.48.0...
- Installed hetznercloud/hcloud v1.48.0 (signed by a HashiCorp partner, key ID 5219EACB3A77198B)
- Installing hashicorp/local v2.5.1...
- Installed hashicorp/local v2.5.1 (signed by HashiCorp)
- Installing loafoe/ssh v2.7.0...
- Installed loafoe/ssh v2.7.0 (self-signed, key ID C0E4EB79E9E6A23D)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has been successfully initialized!
hcloud_ssh_key.server: Refreshing state... [id=24629412]
hcloud_network.network: Refreshing state... [id=10359702]
hcloud_placement_group.workers["pool1"]: Refreshing state... [id=421156]
hcloud_network_subnet.subnet: Refreshing state... [id=10359702-10.0.0.0/16]
hcloud_server.workers[1]: Refreshing state... [id=55742955]
hcloud_server.workers[0]: Refreshing state... [id=55742953]
hcloud_firewall.firewall: Refreshing state... [id=1740667]
hcloud_server.manager[0]: Refreshing state... [id=55742954]
ssh_resource.workers_ready[1]: Refreshing state... [id=3929059511596064850]
ssh_resource.workers_ready[0]: Refreshing state... [id=8802200626328928235]
ssh_resource.manager_ready[0]: Refreshing state... [id=2259762647014294198]
module.k3s.ssh_resource.initial_manager: Refreshing state... [id=1257207361098552077]
module.k3s.ssh_sensitive_resource.join_token: Refreshing state... [id=1118133096612813927]
module.k3s.ssh_sensitive_resource.kubeconfig: Refreshing state... [id=4284976079349531178]
local_sensitive_file.kubeconfig: Refreshing state... [id=5c26d8c02492f0b93e0a65ff2a9e6383abbe8195]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-1"]: Refreshing state... [id=8991009740447318170]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-0"]: Refreshing state... [id=6622661333265324505]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-0"]: Refreshing state... [id=1344319781362143294]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-1"]: Refreshing state... [id=5286355072201017129]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # hcloud_firewall.firewall will be updated in-place
  ~ resource "hcloud_firewall" "firewall" {
        id     = "1740667"
        name   = "prod-k3s-firewall"
        # (1 unchanged attribute hidden)

      - rule {
          - description     = "Allow ICMP (ping)" -> null
          - destination_ips = [] -> null
          - direction       = "in" -> null
          - protocol        = "icmp" -> null
          - source_ips      = [
              - "0.0.0.0/0",
              - "::/0",
            ] -> null
            # (1 unchanged attribute hidden)
        }
      + rule {
          + description     = "Allow ICMP (ping)"
          + destination_ips = []
          + direction       = "in"
          + protocol        = "icmp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS TCP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "tcp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS TCP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "udp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }

        # (12 unchanged blocks hidden)
    }

  # local_sensitive_file.kubeconfig will be created
  + resource "local_sensitive_file" "kubeconfig" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0755"
      + file_permission      = "0600"
      + filename             = "/github/workspace/.kubeconfig"
      + id                   = (known after apply)
    }

Plan: 1 to add, 1 to change, 0 to destroy.
time=2024-11-17T16:44:42Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/kubernetes into /github/workspace/stacks/prod/kubernetes/.terragrunt-cache/-HGVTuUtXSFDQCN7IIesL6CulRY/z4vfL_CY3720zQ-fo9fFtb8YbxA prefix=[/github/workspace/stacks/prod/kubernetes] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of hashicorp/helm from the dependency lock file
- Reusing previous version of hashicorp/kubernetes from the dependency lock file
- Installing hashicorp/helm v2.14.1...
- Installed hashicorp/helm v2.14.1 (signed by HashiCorp)
- Installing hashicorp/kubernetes v2.31.0...
- Installed hashicorp/kubernetes v2.31.0 (signed by HashiCorp)
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.

Terraform has been successfully initialized!
kubernetes_namespace_v1.metallb: Refreshing state... [id=metallb-system]
kubernetes_namespace_v1.argocd: Refreshing state... [id=argocd]
kubernetes_secret_v1.hcloud: Refreshing state... [id=kube-system/hcloud]
kubernetes_namespace_v1.external_secrets: Refreshing state... [id=external-secrets]
helm_release.hcloud_ccm: Refreshing state... [id=hccm]
helm_release.hcloud_csi: Refreshing state... [id=hcsi]
kubernetes_secret_v1.infisical: Refreshing state... [id=external-secrets/infisical]
kubernetes_secret_v1.github_secret: Refreshing state... [id=argocd/github-oidc]
helm_release.argocd: Refreshing state... [id=argocd]
kubernetes_config_map_v1.metallb: Refreshing state... [id=metallb-system/nodes]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # data.kubernetes_nodes.cluster will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "kubernetes_nodes" "cluster" {
      + id    = (known after apply)
      + nodes = (known after apply)
    }

  # helm_release.hcloud_ccm will be updated in-place
  ~ resource "helm_release" "hcloud_ccm" {
        id                         = "hccm"
      ~ metadata                   = [
          - {
              - chart          = "hcloud-cloud-controller-manager"
              - first_deployed = 1731778592
              - last_deployed  = 1731778592
              - name           = "hccm"
              - namespace      = "kube-system"
              - notes          = <<-EOT
                    
                EOT
              - revision       = 1
              - values         = jsonencode(
                    {
                      - networking     = {
                          - clusterCIDR = "10.42.0.0/16"
                          - enabled     = true
                        }
                      - podAnnotations = {
                          - secret = "bd1881f1cb3b873dbd189e2b34b83e5c65f6cd6252e3fce66d8c06ef65f09b06a6bac702f7f4ab13270b36cae104cf2cd76b6480a327fe10b57b054f7ec90813"
                        }
                    }
                )
              - version        = "1.20.0"
                # (1 unchanged attribute hidden)
            },
        ] -> (known after apply)
        name                       = "hccm"
      + values                     = [
          + <<-EOT
                networking:
                  enabled: true
                
                env:
                  HCLOUD_LOAD_BALANCERS_ENABLED:
                    value: "false"
            EOT,
        ]
        # (26 unchanged attributes hidden)

      - set {
          # At least one attribute in this block is (or was) sensitive,
          # so its contents will not be displayed.
        }

        # (2 unchanged blocks hidden)
    }

  # kubernetes_config_map_v1.metallb will be updated in-place
  ~ resource "kubernetes_config_map_v1" "metallb" {
      ~ data        = {
          - "resource" = <<-EOT
                "apiVersion": "metallb.io/v1beta1"
                "kind": "IPAddressPool"
                "metadata":
                  "name": "nodes"
                  "namespace": "metallb-system"
                "spec":
                  "addresses":
                  - "5.75.184.75/32"
            EOT
        } -> (known after apply)
        id          = "metallb-system/nodes"
        # (2 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

Copy link

Execution result of "run-all plan" in "stacks/prod"
time=2024-11-17T16:46:48Z level=info msg=The stack at /github/workspace/stacks/prod will be processed in the following order for command plan:
Group 1
- Module /github/workspace/stacks/prod/hetzner

Group 2
- Module /github/workspace/stacks/prod/kubernetes


time=2024-11-17T16:46:48Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/hetzner into /github/workspace/stacks/prod/hetzner/.terragrunt-cache/7n5v_ZVOv4gLIvn-SLBHuU7F7OI/B-HSI5LUu0nLTnyopQYP4SLEkoU prefix=[/github/workspace/stacks/prod/hetzner] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing modules...
Downloading git::https://github.com/mrsimonemms/terraform-module-k3s.git for k3s...
- k3s in .terraform/modules/k3s
Initializing provider plugins...
- Reusing previous version of hashicorp/local from the dependency lock file
- Reusing previous version of loafoe/ssh from the dependency lock file
- Reusing previous version of hetznercloud/hcloud from the dependency lock file
- Installing hashicorp/local v2.5.1...
- Installed hashicorp/local v2.5.1 (signed by HashiCorp)
- Installing loafoe/ssh v2.7.0...
- Installed loafoe/ssh v2.7.0 (self-signed, key ID C0E4EB79E9E6A23D)
- Installing hetznercloud/hcloud v1.48.0...
- Installed hetznercloud/hcloud v1.48.0 (signed by a HashiCorp partner, key ID 5219EACB3A77198B)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has been successfully initialized!
hcloud_network.network: Refreshing state... [id=10359702]
hcloud_ssh_key.server: Refreshing state... [id=24629412]
hcloud_placement_group.workers["pool1"]: Refreshing state... [id=421156]
hcloud_network_subnet.subnet: Refreshing state... [id=10359702-10.0.0.0/16]
hcloud_firewall.firewall: Refreshing state... [id=1740667]
hcloud_server.workers[1]: Refreshing state... [id=55742955]
hcloud_server.workers[0]: Refreshing state... [id=55742953]
hcloud_server.manager[0]: Refreshing state... [id=55742954]
ssh_resource.workers_ready[0]: Refreshing state... [id=8802200626328928235]
ssh_resource.workers_ready[1]: Refreshing state... [id=3929059511596064850]
ssh_resource.manager_ready[0]: Refreshing state... [id=2259762647014294198]
module.k3s.ssh_resource.initial_manager: Refreshing state... [id=1257207361098552077]
module.k3s.ssh_sensitive_resource.join_token: Refreshing state... [id=1118133096612813927]
module.k3s.ssh_sensitive_resource.kubeconfig: Refreshing state... [id=4284976079349531178]
local_sensitive_file.kubeconfig: Refreshing state... [id=5c26d8c02492f0b93e0a65ff2a9e6383abbe8195]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-0"]: Refreshing state... [id=6622661333265324505]
module.k3s.ssh_resource.install_workers["prod-k3s-pool1-1"]: Refreshing state... [id=8991009740447318170]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-0"]: Refreshing state... [id=1344319781362143294]
module.k3s.ssh_resource.drain_workers["prod-k3s-pool1-1"]: Refreshing state... [id=5286355072201017129]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # hcloud_firewall.firewall will be updated in-place
  ~ resource "hcloud_firewall" "firewall" {
        id     = "1740667"
        name   = "prod-k3s-firewall"
        # (1 unchanged attribute hidden)

      - rule {
          - description     = "Allow ICMP (ping)" -> null
          - destination_ips = [] -> null
          - direction       = "in" -> null
          - protocol        = "icmp" -> null
          - source_ips      = [
              - "0.0.0.0/0",
              - "::/0",
            ] -> null
            # (1 unchanged attribute hidden)
        }
      + rule {
          + description     = "Allow ICMP (ping)"
          + destination_ips = []
          + direction       = "in"
          + protocol        = "icmp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS TCP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "tcp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }
      + rule {
          + description     = "PiHole DNS UDP"
          + destination_ips = []
          + direction       = "in"
          + port            = "53"
          + protocol        = "udp"
          + source_ips      = [
              + "0.0.0.0/0",
              + "::/0",
            ]
        }

        # (12 unchanged blocks hidden)
    }

  # local_sensitive_file.kubeconfig will be created
  + resource "local_sensitive_file" "kubeconfig" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0755"
      + file_permission      = "0600"
      + filename             = "/github/workspace/.kubeconfig"
      + id                   = (known after apply)
    }

Plan: 1 to add, 1 to change, 0 to destroy.
time=2024-11-17T16:46:54Z level=info msg=Downloading Terraform configurations from file:///github/workspace/modules/kubernetes into /github/workspace/stacks/prod/kubernetes/.terragrunt-cache/-HGVTuUtXSFDQCN7IIesL6CulRY/z4vfL_CY3720zQ-fo9fFtb8YbxA prefix=[/github/workspace/stacks/prod/kubernetes] 
Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of hashicorp/helm from the dependency lock file
- Reusing previous version of hashicorp/kubernetes from the dependency lock file
- Installing hashicorp/helm v2.14.1...
- Installed hashicorp/helm v2.14.1 (signed by HashiCorp)
- Installing hashicorp/kubernetes v2.31.0...
- Installed hashicorp/kubernetes v2.31.0 (signed by HashiCorp)
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.

Terraform has been successfully initialized!
kubernetes_namespace_v1.argocd: Refreshing state... [id=argocd]
kubernetes_namespace_v1.external_secrets: Refreshing state... [id=external-secrets]
kubernetes_secret_v1.hcloud: Refreshing state... [id=kube-system/hcloud]
kubernetes_namespace_v1.metallb: Refreshing state... [id=metallb-system]
kubernetes_secret_v1.github_secret: Refreshing state... [id=argocd/github-oidc]
kubernetes_secret_v1.infisical: Refreshing state... [id=external-secrets/infisical]
helm_release.hcloud_csi: Refreshing state... [id=hcsi]
helm_release.hcloud_ccm: Refreshing state... [id=hccm]
helm_release.argocd: Refreshing state... [id=argocd]
kubernetes_config_map_v1.metallb: Refreshing state... [id=metallb-system/nodes]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # data.kubernetes_nodes.cluster will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "kubernetes_nodes" "cluster" {
      + id    = (known after apply)
      + nodes = (known after apply)
    }

  # helm_release.hcloud_ccm will be updated in-place
  ~ resource "helm_release" "hcloud_ccm" {
        id                         = "hccm"
      ~ metadata                   = [
          - {
              - chart          = "hcloud-cloud-controller-manager"
              - first_deployed = 1731778592
              - last_deployed  = 1731778592
              - name           = "hccm"
              - namespace      = "kube-system"
              - notes          = <<-EOT
                    
                EOT
              - revision       = 1
              - values         = jsonencode(
                    {
                      - networking     = {
                          - clusterCIDR = "10.42.0.0/16"
                          - enabled     = true
                        }
                      - podAnnotations = {
                          - secret = "bd1881f1cb3b873dbd189e2b34b83e5c65f6cd6252e3fce66d8c06ef65f09b06a6bac702f7f4ab13270b36cae104cf2cd76b6480a327fe10b57b054f7ec90813"
                        }
                    }
                )
              - version        = "1.20.0"
                # (1 unchanged attribute hidden)
            },
        ] -> (known after apply)
        name                       = "hccm"
      + values                     = [
          + <<-EOT
                networking:
                  enabled: true
                
                env:
                  HCLOUD_LOAD_BALANCERS_ENABLED:
                    value: "false"
            EOT,
        ]
        # (26 unchanged attributes hidden)

      - set {
          # At least one attribute in this block is (or was) sensitive,
          # so its contents will not be displayed.
        }

        # (2 unchanged blocks hidden)
    }

  # kubernetes_config_map_v1.metallb will be updated in-place
  ~ resource "kubernetes_config_map_v1" "metallb" {
      ~ data        = {
          - "resource" = <<-EOT
                "apiVersion": "metallb.io/v1beta1"
                "kind": "IPAddressPool"
                "metadata":
                  "name": "nodes"
                  "namespace": "metallb-system"
                "spec":
                  "addresses":
                  - "5.75.184.75/32"
            EOT
        } -> (known after apply)
        id          = "metallb-system/nodes"
        # (2 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

@mrsimonemms mrsimonemms merged commit b89d50f into main Nov 17, 2024
4 checks passed
@mrsimonemms mrsimonemms deleted the sje/pihole branch November 17, 2024 16:48
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