GoogleCloudPlatform / gke-autoneg-controller

This GKE controller provides simple custom integration between GKE and GCLB.
Apache License 2.0
159 stars 50 forks source link

Add ignore changes to kubernetes service annotations #121

Closed golemiso closed 5 months ago

golemiso commented 5 months ago

Every time I plan, terraform shows diffs of annotations about neg. So I want it to be ignored by adding ignore_change block.

  ~ resource "kubernetes_service" "service_autoneg_controller_manager_metrics_service" {
        id                     = "autoneg-system/autoneg-controller-manager-metrics-service"
        # (2 unchanged attributes hidden)

      ~ metadata {
          ~ annotations      = {
              ~ "cloud.google.com/neg"        = jsonencode(
                  ~ {
                      - exposed_ports = {
                          - "8443" = {}
                        }
                    }
                )
              - "cloud.google.com/neg-status" = jsonencode(
                    {
                      - network_endpoint_groups = {
                          - "8443" = "xxx"
                        }
                      - zones                   = [
                          - "xxx-a",
                          - "xxx-b",
                          - "xxx-c",
                        ]
                    }
                ) -> null
                # (3 unchanged elements hidden)
            }
            name             = "autoneg-controller-manager-metrics-service"
            # (5 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

By the way, thank you for the useful solutions!

rosmo commented 5 months ago

LGTM