Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deletion_protection field in cloudvmcluster resource #12297

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions mmv1/products/oracledatabase/CloudVmCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,20 @@ async:
error:
path: 'error'
message: 'message'
custom_code:
pre_delete: 'templates/terraform/pre_delete/oracledatabase_cloud_vmcluster.go.tmpl'
examples:
- name: 'oracledatabase_cloud_vmcluster_basic'
primary_resource_id: 'my_vmcluster'
vars:
project: 'my-project'
cloud_vm_cluster_id: 'my-instance'
cloud_exadata_infrastructure_id: 'my-exadata'
deletion_protection: 'true'
ignore_read_extra:
- 'deletion_protection'
test_vars_overrides:
'deletion_protection': 'false'
'project': '"oci-terraform-testing"'
'cloud_vm_cluster_id': '"ofake-vmcluster-basic"'
'cloud_exadata_infrastructure_id': '"ofake-exadata-for-vm-basic"'
Expand All @@ -66,10 +72,21 @@ examples:
project: 'my-project'
cloud_vm_cluster_id: 'my-instance'
cloud_exadata_infrastructure_id: 'my-exadata'
deletion_protection: 'true'
ignore_read_extra:
- 'deletion_protection'
test_vars_overrides:
'deletion_protection': 'false'
'project': '"oci-terraform-testing"'
'cloud_vm_cluster_id': '"ofake-vmcluster-full"'
'cloud_exadata_infrastructure_id': '"ofake-exadata-for-vm-full"'
virtual_fields:
- name: 'deletion_protection'
hao-nan-li marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -14,6 +14,8 @@ resource "google_oracle_database_cloud_vm_cluster" "{{$.PrimaryResourceId}}"{
gi_version = "19.0.0.0"
hostname_prefix = "hostname1"
}

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

resource "google_oracle_database_cloud_exadata_infrastructure" "cloudExadataInfrastructures"{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ resource "google_oracle_database_cloud_vm_cluster" "{{$.PrimaryResourceId}}"{
}
memory_size_gb = 60
}

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

resource "google_oracle_database_cloud_exadata_infrastructure" "cloudExadataInfrastructures"{
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_vm_cluster resource with id : %q without setting deletion_protection=false and running `terraform apply`", d.Id())
}
Loading