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.34k stars 1.74k forks source link

Add missing import_method valid options for google_kms_key_ring_import_job. #17466

Open romanini-ciandt opened 8 months ago

romanini-ciandt commented 8 months ago

Community Note

Description

Comparing google_kms_key_ring_import_job terraform resource with keyring import-jobs API it is possible to notice that specifically for import_method field:

For the use case I'm building a terraform automation, I have the explicit requirement to use rsa-oaep-4096-sha256 and because it is not available I won't be able to achieve the expected result by using google_kms_key_ring_import_job resource. I'll need to use gcloud instead.

New or Affected Resource(s)

Potential Terraform Configuration

resource "google_kms_key_ring_import_job" "import-job" {
  key_ring      = google_kms_key_ring.keyring.id
  import_job_id = "import-job-id"

  import_method    = "rsa-oaep-4096-sha256" // Desired but not available import_method option
  protection_level = "HSM"
}

References

No response

b/328081938

tdbhacks commented 8 months ago

Without having taken a very close look, this might be an easy fix: https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/products/kms/KeyRingImportJob.yaml#L70-L78

We'll have to check the tests and if anything else needs to be changed though

melinath commented 8 months ago

Note from triage: Actual list of values that should be supported: https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.importJobs#importmethod

If this field is expected to change frequently, it could make sense to eliminate the validation of enum values altogether so the provider doesn't have to be updated each time.