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.33k stars 1.73k forks source link

google_compute_machine_image does not support machine_image_encryption_key configuration #9082

Closed PrateekKhatri closed 3 years ago

PrateekKhatri commented 3 years ago

While adding "machine_image_encryption_key" configuration getting "Computed attributes cannot be set, but a value was set for machine_image_encryption_key.0.kms_key_name" error.

Below is the code:

Provide version used : 3.64.0

Source Code resource "google_compute_machine_image" "image" { provider = google-beta project = var.project_name name = "${var.env_name}-${var.infra_type}-machine-image" machine_image_encryption_key { kms_key_name = "projects/${var.project_name}/locations/global/keyRings/${var.key_ring_name}/cryptoKeys/${var.key_name}" } source_instance = google_compute_instance.vm.self_link }

Getting below error while running terraform plan or apply: Error: Computed attributes cannot be set

on ......\gcp_infrastructure_samples\infra_samples\modules\compute_machine_image\machineimage.tf line 8, in resource "google_compute_machine_image" "image": 8: kms_key_name = "projects/cspm-dev/locations/global/keyRings/aj-kms-01/cryptoKeys/key-symmetric-01"

Computed attributes cannot be set, but a value was set for "machine_image_encryption_key.0.kms_key_name".

venkykuberan commented 3 years ago

kms_key_name is set as computed here although it shouldn't be. We will fix it, thank you for filing the issue

PrateekKhatri commented 3 years ago

Thanks for the update.

github-actions[bot] commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.