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

shielded_instance_config values are not honoured when field values are set to "false" #20203

Open
jkrisht opened this issue Nov 6, 2024 · 2 comments

Comments

@jkrisht
Copy link

jkrisht commented Nov 6, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform ~>v1.2
on

  • provider registry.terraform.io/hashicorp/google v6.9.0

Affected Resource(s)

google_dataproc_*

Terraform Configuration

resource "google_dataproc_cluster" "dataproc_spark" {
  name   = "rapids-cluster-1"
  region = "us-central1"
  

  cluster_config {
    staging_bucket = "bucket_name"
    gce_cluster_config {
      shielded_instance_config {
        enable_secure_boot          = false
        enable_integrity_monitoring = false
        enable_vtpm                 = false
      }
      # Define the network and subnetwork here, if required
      subnetwork = "default"
    }

    # Master node configuration
    master_config {
      num_instances = 1
      machine_type  = "n1-standard-4"
    }

    # Worker node configuration
    worker_config {
      num_instances = 2
      machine_type  = "n1-standard-4"
    }
    software_config {
      image_version = "2.2-ubuntu22"
    }

    initialization_action {
      script      = "gs://goog-dataproc-initialization-actions-us-central1/spark-rapids/spark-rapids.sh"
      timeout_sec = 60
    }
  }
}

Debug Output

No response

Expected Behavior

Terraform - Google should pass the given configuration to the google cloud APIs. Below is the expected where we can see the shieldedInstanceConfig value is being passed.

{
 "clusterName": "rapids-cluster-1",
 "config": {
  "configBucket": "dprtrial",
  "gceClusterConfig": {
   "internalIpOnly": false,
   "shieldedInstanceConfig": {
    "enableSecureBoot": true,
    "enableVtpm": true,
    "enableIntegrityMonitoring": true
   },
   "subnetworkUri": "projects/rising-woods-374602/regions/us-central1/subnetworks/default"
  },
  "initializationActions": [
   {
    "executableFile": "gs://goog-dataproc-initialization-actions-us-central1/spark-rapids/spark-rapids.sh",
    "executionTimeout": "60s"
   }
  ],
  "masterConfig": {
   "machineTypeUri": "n1-standard-4",
   "numInstances": 1
  },
  "softwareConfig": {
   "imageVersion": "2.2-ubuntu"
  },
  "workerConfig": {
   "machineTypeUri": "n1-standard-4",
   "numInstances": 2
  }
 },
 "projectId": "rising-woods-374602"
}

Actual Behavior

shieldedInstanceConfig object is being passed as empty when we try to pass false values. Same works fine when we set true.

Note: We have tried without shielded_instance_config (default to false), still dataproc cluster VMs are being created with secure boot enabled.

{
 "clusterName": "rapids-cluster-1",
 "config": {
  "configBucket": "dprtrial",
  "gceClusterConfig": {
   "internalIpOnly": false,
   "shieldedInstanceConfig": {},
   "subnetworkUri": "projects/rising-woods-374602/regions/us-central1/subnetworks/default"
  },
  "initializationActions": [
   {
    "executableFile": "gs://goog-dataproc-initialization-actions-us-central1/spark-rapids/spark-rapids.sh",
    "executionTimeout": "60s"
   }
  ],
  "masterConfig": {
   "machineTypeUri": "n1-standard-4",
   "numInstances": 1
  },
  "softwareConfig": {
   "imageVersion": "2.2-ubuntu"
  },
  "workerConfig": {
   "machineTypeUri": "n1-standard-4",
   "numInstances": 2
  }
 },
 "projectId": "rising-woods-374602"
}

Steps to reproduce

  1. terraform init
  2. terraform apply

b/379163160

@jkrisht jkrisht added the bug label Nov 6, 2024
@ggtisc ggtisc self-assigned this Nov 11, 2024
@ggtisc ggtisc added service/dataproc forward/review In review; remove label to forward labels Nov 11, 2024
@ggtisc
Copy link
Collaborator

ggtisc commented Nov 14, 2024

Confirmed issue!

Even if the attributes enable_secure_boot, enable_integrity_monitoring and enable_vtpm were set to false, after creating the google_dataproc_cluster they were set with true value in the tfstate file

@ggtisc ggtisc removed the forward/review In review; remove label to forward label Nov 14, 2024
@ggtisc ggtisc removed their assignment Nov 14, 2024
@ahzaz
Copy link

ahzaz commented Dec 4, 2024

Seems like setting value to false ignores the set value and due to type being bool in ShieldedInstanceConfig. Probably similar issue as this. However, in this case ShieldedInstanceConfig is from Dataproc APIs.

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

No branches or pull requests

4 participants