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

google_healthcare_fhir_store.enable_history_import should be deprecated #13482

Open aebrahim opened 1 year ago

aebrahim commented 1 year ago

Community Note

Terraform Version

Terraform v1.3.7
on linux_amd64
+ provider registry.terraform.io/datadog/datadog v3.19.1
+ provider registry.terraform.io/hashicorp/external v2.2.3
+ provider registry.terraform.io/hashicorp/google v4.47.0
+ provider registry.terraform.io/hashicorp/google-beta v4.47.0
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.4.3
+ provider registry.terraform.io/hashicorp/time v0.9.1

Affected Resource(s)

Terraform Configuration Files

resource "google_healthcare_dataset" "myset" {
  name     = "myset"
  location = "us-central1"
}

resource "google_healthcare_fhir_store" "mystore" {
  name                  = "mystore"
  dataset               = google_healthcare_dataset.myset.id
  version               = "R4"
  enable_update_create  = true
  enable_history_import = true
}

Debug Output

2023-01-12T18:30:24.344-0800 [DEBUG] ReferenceTransformer: "google_healthcare_fhir_store.mystore" references: [google_healthcare_dataset.myset]
2023-01-12T18:30:24.804-0800 [DEBUG] ProviderTransformer: "google_healthcare_fhir_store.mystore (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/google"]
2023-01-12T18:30:24.816-0800 [DEBUG] ReferenceTransformer: "google_healthcare_fhir_store.mystore (expand)" references: [google_healthcare_dataset.myset (expand)]
2023-01-12T18:30:25.653-0800 [DEBUG] ReferenceTransformer: "google_healthcare_fhir_store.mystore" references: []
GET /v1/projects/delfina-gaia-dev/locations/us-central1/datasets/redox/fhirStores/redox?alt=json HTTP/1.1
  "name": "projects/delfina-gaia-dev/locations/us-central1/datasets/redox/fhirStores/redox",
2023-01-12T18:30:25.767-0800 [WARN]  Provider "registry.terraform.io/hashicorp/google" produced an unexpected new value for google_healthcare_fhir_store.mystore during refresh.
2023-01-12T18:30:25.771-0800 [WARN]  Provider "registry.terraform.io/hashicorp/google" produced an invalid plan for google_healthcare_fhir_store.mystore, but we are tolerating it because it is using the legacy plugin SDK.
2023-01-12T18:30:25.833-0800 [DEBUG] ProviderTransformer: "google_healthcare_fhir_store.mystore (destroy)" (*terraform.NodeDestroyResourceInstance) needs provider["registry.terraform.io/hashicorp/google"]
2023-01-12T18:30:25.833-0800 [DEBUG] ProviderTransformer: "google_healthcare_fhir_store.mystore" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/hashicorp/google"]
2023-01-12T18:30:25.834-0800 [DEBUG] ProviderTransformer: "google_healthcare_fhir_store.mystore (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hashicorp/google"]
2023-01-12T18:30:25.839-0800 [DEBUG] ReferenceTransformer: "google_healthcare_fhir_store.mystore" references: [google_healthcare_dataset.myset (expand)]
2023-01-12T18:30:25.840-0800 [DEBUG] ReferenceTransformer: "google_healthcare_fhir_store.mystore (expand)" references: []

Expected Behavior

Running terraform plan a second time after a successful run should produce no diff

Actual Behavior

Running terraform plan produces the following diff

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: -/+ destroy and then create replacement

Terraform will perform the following actions:

  # google_healthcare_fhir_store.mystore must be replaced
-/+ resource "google_healthcare_fhir_store" "mystore" {
      - disable_referential_integrity = false -> null
      - disable_resource_versioning   = false -> null
      ~ enable_history_import         = false -> true # forces replacement
      ~ id                            = "projects/myproject/locations/us-central1/datasets/myset/fhirStores/mystore" -> (known after apply)
      - labels                        = {} -> null
        name                          = "mystore"
      ~ self_link                     = "projects/myproject/locations/us-central1/datasets/myset/fhirStores/mystore" -> (known after apply)
        # (3 unchanged attributes hidden)
    }

Steps to Reproduce

  1. Make a google_healthcare_fhir_store with enable_history_import set to True
  2. terraform apply
  3. terraform plan will now attempt to delete and recreate the store with enable_history_import set to True because it thinks it is False

b/293327428

edwardmedia commented 1 year ago

It appears an API issue

POST /v1/projects/myproject/locations/us-central1/datasets/issue13482/fhirStores?alt=json&fhirStoreId=issue13482 HTTP/1.1
Host: healthcare.googleapis.com
{
 "enableHistoryImport": true,
 "enableUpdateCreate": true,
 "name": "issue13482",
 "version": "R4"
}

---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
{
  "name": "projects/myproject/locations/us-central1/datasets/issue13482/fhirStores/issue13482",
  "enableUpdateCreate": true,
  "version": "R4"
}

b/265375988

edwardmedia commented 1 year ago

enable_history_import is deprecated. Per b/265375988