delphix-integrations / terraform-provider-delphix

Repository for Delphix Terraform Provider built on DCT APIs.
https://integrations.delphix.com
11 stars 9 forks source link

Escl 4868 : Failing Delphix Terraform DCT provider updates #83

Closed ankit-patil-hubs closed 5 months ago

ankit-patil-hubs commented 5 months ago

Problem:

in release 3.2.0 we introduced 2 new schema variables in dsource resource , the intention was to use these for a new polling logic where based on these 2 variables we poll for snapshot creation to be completed ,post dsource job polling is completed .

"wait_time": {
    Type:     schema.TypeInt,
    Default:  3,
    Optional: true,
},
"skip_wait_for_snapshot_creation": {
    Type:     schema.TypeBool,
    Default:  false,
    Optional: true,
},

for the user in case of an upgrade from 3.1.0 -> 3.2.0 "wait_time" is getting added to the state file and identified as a changed attribute which caused the drift and hence the failure, since we have defined "wait_time" as int with "Default: 3", terraform first adds the value as 0 and then later updates it to 3 which has caused this drift, we don't this drift for "skip_wait_for_snapshot_creation" because it is of type boolean .

Solution:

removed the default from "wait_time" i.e it will be assigned to 0 by default and no attribute change will be detected by terraform

Testing

upgrade to 3.2.0

delphix_appdata_dsource.test_app_data_dsource_second: Refreshing state... [id=13-APPDATA_CONTAINER-160]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # delphix_appdata_dsource.test_app_data_dsource_second will be updated in-place
  ~ resource "delphix_appdata_dsource" "test_app_data_dsource_second" {
        id                              = "13-APPDATA_CONTAINER-160"
        name                            = "appdata_dsource_second_new"
      ~ wait_time                       = 0 -> 3
        # (23 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

upgrade to 3.2.1 resolves this

ankit.patil@Ankit-Patils-MacBook-Pro postgresql % terraform plan          
delphix_appdata_dsource.test_app_data_dsource_second: Refreshing state... [id=13-APPDATA_CONTAINER-160]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
ankit.patil@Ankit-Patils-MacBook-Pro postgresql % terraform apply
delphix_appdata_dsource.test_app_data_dsource_second: Refreshing state... [id=13-APPDATA_CONTAINER-160]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Manually tested