oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
731 stars 668 forks source link

terraform plan fails to check many argument dependencies on resources oci_database_autonomous_database. #1791

Open luckeyca opened 1 year ago

luckeyca commented 1 year ago

Community Note

Terraform Version and Provider Version

Terraform v1.3.9 on linux_amd64

oci_database_autonomous_database

Terraform Configuration Files

character_set                                  = var.db_workload == "AJD" ? null : var.character_set
ncharacter_set                                = var.db_workload == "AJD" ? null : var.ncharacter_set
is_dedicated                                   = var.db_workload == "AJD" || var.db_workload == "APEX" ? false : var.is_dedicated
is_mtls_connection_required         = var.db_workload == "APEX" ? true : var.is_mtls_connection_required
whitelisted_ips = length(var.subnet_id) != 0 ? (data.oci_core_subnet.this[0].prohibit_internet_ingress == false && data.oci_core_subnet.this[0].prohibit_public_ip_on_vnic == false ? var.whitelisted_ips : null) : var.whitelisted_ips
nsg_ids         = length(var.subnet_id) != 0 ? (data.oci_core_subnet.this[0].prohibit_internet_ingress == true && data.oci_core_subnet.this[0].prohibit_public_ip_on_vnic == true ? var.nsg_ids : null) : null
operations_insights_status = var.db_workload == "AJD" || var.db_workload == "APEX" ? "NOT_ENABLED" : "ENABLED"

Expected Behavior

All the known dependencies should be checked by "terraform plan"

Actual Behavior

NONE of the known dependencies are checked by terraform plan, but only failed at "terraform apply" which is very bad and an operations risk.

Steps to Reproduce

  1. from the code snippet above, remove the custom conditions and specify value with known conflicting dependency
  2. terraform plan will SUCCEED
  3. terraform apply will FAIL

Important Factoids

References

luckeyca commented 1 year ago

looks like input validate does NOT exist in general for terraform plan on this resource. for example, if there is already an adb with the same name exists on oci, terraform plan will still succeed, and then will fail on apply given adb name must be unique across the same tenant.

ravinitp commented 1 year ago

Thank you for reporting the issue. We have raised an internal ticket to track this. Our service engineers will get back to you.

xiaoditao1 commented 1 year ago

We already have an internal dev ticket to work on this. Please close this issue and track our internal dev ticket. This opening issue is keep sending oncall tickets to our team.

xiaoditao1 commented 1 year ago

Please track https://jira.oci.oraclecorp.com/browse/DBAASADBS-2063 and close this issue.