hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

Disable one of the features in google_gkehub_feature #14831

Open JeffLuoo opened 1 year ago

JeffLuoo commented 1 year ago

google_gkehub_feature has a field feature and the feature field has another field spec, a new field fleetobservability is added recently and can be configured with following example to enable the fleetobservability feature:

resource "google_gke_hub_feature" "feature" {
  project = "test-project"
  name = "fleetobservability"
  location = "global"
  spec {
    fleetobservability {
      logging_config {
        default_config {
          mode = "COPY"
        }
        fleet_scope_logs_config {
          mode = "MOVE"
        }
      }
    }
  }
  provider = google-beta
}

However, I tried to disable the feature by using the following config:

resource "google_gke_hub_feature" "feature" {
  project = "gke-fleet-obs-dev-fleet-1"
  name = "fleetobservability"
  location = "global"
  spec {
    fleetobservability {
      logging_config {
      }
    }
  }
  provider = google-beta
}

and it failed with the error:

Error: Error updating Feature: googleapi: Error 400: MissingFieldError for field spec: should be set
Details:

I could use similar config if I want to disable the feature with gcloud by following the instruction: https://cloud.google.com/anthos/fleet-management/docs/fleet-logs#disable_fleet_logging. Hence I wonder how could I disable the fleetobservability feature with the terraform.

edwardmedia commented 1 year ago

b/286127157

sahsagar-google commented 10 months ago

@JeffLuoo You will need to remove the entire resource "google_gke_hub_feature" "feature" from your terraform script.