Skip to content

Commit

Permalink
Add deletion_protection field for cloudExadataInfrastructure resource (
Browse files Browse the repository at this point in the history
  • Loading branch information
tulika-aakriti authored Nov 26, 2024
1 parent 6eb3aa9 commit df8eb1b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mmv1/products/oracledatabase/CloudExadataInfrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,39 @@ async:
path: 'error'
message: 'message'
custom_code:
pre_delete: 'templates/terraform/pre_delete/oracledatabase_cloud_exadata_infrastructure.go.tmpl'
examples:
- name: 'oracledatabase_cloud_exadata_infrastructure_basic'
primary_resource_id: 'my-cloud-exadata'
vars:
project: 'my-project'
cloud_exadata_infrastructure_id: 'my-instance'
deletion_protection: 'true'
ignore_read_extra:
- 'deletion_protection'
test_vars_overrides:
'project': '"oci-terraform-testing"'
'deletion_protection': 'false'
'cloud_exadata_infrastructure_id': '"ofake-exadata-basic"'
- name: 'oracledatabase_cloud_exadata_infrastructure_full'
primary_resource_id: 'my-cloud-exadata'
vars:
project: 'my-project'
cloud_exadata_infrastructure_id: 'my-instance'
deletion_protection: 'true'
ignore_read_extra:
- 'deletion_protection'
test_vars_overrides:
'project': '"oci-terraform-testing"'
'deletion_protection': 'false'
'cloud_exadata_infrastructure_id': '"ofake-exadata-full"'
virtual_fields:
- name: 'deletion_protection'
type: Boolean
default_value: true
description: 'Whether or not to allow Terraform to destroy the instance.
Unless this field is set to false in Terraform state, a terraform destroy
or terraform apply that would delete the instance will fail.'
parameters:
- name: 'location'
type: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ resource "google_oracle_database_cloud_exadata_infrastructure" "{{$.PrimaryResou
compute_count= "2"
storage_count= "3"
}

deletion_protection = "{{index $.Vars "deletion_protection"}}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ resource "google_oracle_database_cloud_exadata_infrastructure" "{{$.PrimaryResou
labels = {
"label-one" = "value-one"
}

deletion_protection = "{{index $.Vars "deletion_protection"}}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ resource "google_oracle_database_cloud_exadata_infrastructure" "cloudExadataInfr
compute_count= "2"
storage_count= "3"
}

deletion_protection = "{{index $.Vars "deletion_protection"}}"
}

data "google_compute_network" "default" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ resource "google_oracle_database_cloud_exadata_infrastructure" "cloudExadataInfr
compute_count= "2"
storage_count= "3"
}

deletion_protection = "{{index $.Vars "deletion_protection"}}"
}

data "google_compute_network" "default" {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if d.Get("deletion_protection").(bool) {
return fmt.Errorf("cannot destroy google_oracle_database_cloud_exadata_infrastructure resource with id : %q without setting deletion_protection=false and running `terraform apply`", d.Id())
}

0 comments on commit df8eb1b

Please sign in to comment.