When the VDB was deleted from the engine and terraform plan was being executed, the drift detection mechanism in the provider was not working as expected.Even though the VDB was deleted from the remote the state file reference wasn't getting cleaned up resulting in a hang like behaviour.
Solution:
The drift mechanism was fixed and terraform plan was executing as expected.Also we added extra checks to ensure there is no false override of the state file.
Testing
Tested VDB deletion flow and terraform commands
`## Creating a VDB using terraform
terraform apply --auto-approve
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
create
Terraform will perform the following actions:
delphix_vdb.test will be created
resource "delphix_vdb" "test" {
auto_select_repository = true
creation_date = (known after apply)
database_type = (known after apply)
database_version = (known after apply)
engine_id = (known after apply)
environment_id = (known after apply)
fqdn = (known after apply)
group_name = (known after apply)
id = (known after apply)
ip_address = (known after apply)
name = "test_vdb"
parent_id = (known after apply)
provision_type = "snapshot"
source_data_id = "ORACLE_DB_CONTAINER-1"
}
Plan: 1 to add, 0 to change, 0 to destroy.
delphix_vdb.test: Creating...
delphix_vdb.test: Still creating... [10s elapsed]
delphix_vdb.test: Still creating... [20s elapsed]
delphix_vdb.test: Still creating... [30s elapsed]
delphix_vdb.test: Still creating... [40s elapsed]
delphix_vdb.test: Still creating... [50s elapsed]
delphix_vdb.test: Still creating... [1m0s elapsed]
delphix_vdb.test: Still creating... [1m10s elapsed]
delphix_vdb.test: Still creating... [1m20s elapsed]
delphix_vdb.test: Still creating... [1m30s elapsed]
delphix_vdb.test: Still creating... [1m40s elapsed]
delphix_vdb.test: Still creating... [1m50s elapsed]
delphix_vdb.test: Still creating... [2m0s elapsed]
delphix_vdb.test: Still creating... [2m10s elapsed]
delphix_vdb.test: Still creating... [2m20s elapsed]
delphix_vdb.test: Still creating... [2m30s elapsed]
delphix_vdb.test: Still creating... [2m40s elapsed]
delphix_vdb.test: Still creating... [2m50s elapsed]
delphix_vdb.test: Still creating... [3m0s elapsed]
delphix_vdb.test: Creation complete after 3m6s [id=1-ORACLE_DB_CONTAINER-3]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
create
Terraform will perform the following actions:
delphix_vdb.test will be created
resource "delphix_vdb" "test" {
auto_select_repository = true
creation_date = (known after apply)
database_type = (known after apply)
database_version = (known after apply)
engine_id = (known after apply)
environment_id = (known after apply)
fqdn = (known after apply)
group_name = (known after apply)
id = (known after apply)
ip_address = (known after apply)
name = "test_vdb"
parent_id = (known after apply)
provision_type = "snapshot"
source_data_id = "ORACLE_DB_CONTAINER-1"
}
Plan: 1 to add, 0 to change, 0 to destroy.
delphix_vdb.test: Creating...
delphix_vdb.test: Still creating... [10s elapsed]
delphix_vdb.test: Still creating... [20s elapsed]
delphix_vdb.test: Still creating... [30s elapsed]
delphix_vdb.test: Still creating... [40s elapsed]
delphix_vdb.test: Still creating... [50s elapsed]
delphix_vdb.test: Still creating... [1m0s elapsed]
delphix_vdb.test: Still creating... [1m10s elapsed]
delphix_vdb.test: Still creating... [1m20s elapsed]
delphix_vdb.test: Still creating... [1m30s elapsed]
delphix_vdb.test: Still creating... [1m40s elapsed]
delphix_vdb.test: Still creating... [1m50s elapsed]
delphix_vdb.test: Still creating... [2m0s elapsed]
delphix_vdb.test: Still creating... [2m10s elapsed]
delphix_vdb.test: Still creating... [2m20s elapsed]
delphix_vdb.test: Still creating... [2m30s elapsed]
delphix_vdb.test: Creation complete after 2m34s [id=1-ORACLE_DB_CONTAINER-4]
Problem:
When the VDB was deleted from the engine and terraform plan was being executed, the drift detection mechanism in the provider was not working as expected.Even though the VDB was deleted from the remote the state file reference wasn't getting cleaned up resulting in a hang like behaviour.
Solution:
The drift mechanism was fixed and terraform plan was executing as expected.Also we added extra checks to ensure there is no false override of the state file.
Testing
Tested VDB deletion flow and terraform commands `## Creating a VDB using terraform
terraform apply --auto-approve
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
delphix_vdb.test will be created
Plan: 1 to add, 0 to change, 0 to destroy. delphix_vdb.test: Creating... delphix_vdb.test: Still creating... [10s elapsed] delphix_vdb.test: Still creating... [20s elapsed] delphix_vdb.test: Still creating... [30s elapsed] delphix_vdb.test: Still creating... [40s elapsed] delphix_vdb.test: Still creating... [50s elapsed] delphix_vdb.test: Still creating... [1m0s elapsed] delphix_vdb.test: Still creating... [1m10s elapsed] delphix_vdb.test: Still creating... [1m20s elapsed] delphix_vdb.test: Still creating... [1m30s elapsed] delphix_vdb.test: Still creating... [1m40s elapsed] delphix_vdb.test: Still creating... [1m50s elapsed] delphix_vdb.test: Still creating... [2m0s elapsed] delphix_vdb.test: Still creating... [2m10s elapsed] delphix_vdb.test: Still creating... [2m20s elapsed] delphix_vdb.test: Still creating... [2m30s elapsed] delphix_vdb.test: Still creating... [2m40s elapsed] delphix_vdb.test: Still creating... [2m50s elapsed] delphix_vdb.test: Still creating... [3m0s elapsed] delphix_vdb.test: Creation complete after 3m6s [id=1-ORACLE_DB_CONTAINER-3]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Refresh after deletion of VDB from UI:
kishlay.singh@Kishlay-Singhs-MacBook-Pro michelin % terraform refresh delphix_vdb.test: Refreshing state... [id=1-ORACLE_DB_CONTAINER-3]
Apply after refresh
kishlay.singh@Kishlay-Singhs-MacBook-Pro michelin % terraform apply --auto-approve
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
delphix_vdb.test will be created
Plan: 1 to add, 0 to change, 0 to destroy. delphix_vdb.test: Creating... delphix_vdb.test: Still creating... [10s elapsed] delphix_vdb.test: Still creating... [20s elapsed] delphix_vdb.test: Still creating... [30s elapsed] delphix_vdb.test: Still creating... [40s elapsed] delphix_vdb.test: Still creating... [50s elapsed] delphix_vdb.test: Still creating... [1m0s elapsed] delphix_vdb.test: Still creating... [1m10s elapsed] delphix_vdb.test: Still creating... [1m20s elapsed] delphix_vdb.test: Still creating... [1m30s elapsed] delphix_vdb.test: Still creating... [1m40s elapsed] delphix_vdb.test: Still creating... [1m50s elapsed] delphix_vdb.test: Still creating... [2m0s elapsed] delphix_vdb.test: Still creating... [2m10s elapsed] delphix_vdb.test: Still creating... [2m20s elapsed] delphix_vdb.test: Still creating... [2m30s elapsed] delphix_vdb.test: Creation complete after 2m34s [id=1-ORACLE_DB_CONTAINER-4]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.a`