oci_database_db_home

This resource provides the Db Home resource in Oracle Cloud Infrastructure Database service.

Creates a new Database Home in the specified database system based on the request parameters you provide. Applies only to bare metal and Exadata systems.

Important: Unless enable_database_delete is explicitly set to true: * Terraform will not delete the database within the Db Home configuration but rather remove it from the config and state file. * This leads to dangling resources which are not managed via Terraform unless explicitly imported

Important: When auto_backup_enabled is not present in the configuration or set to true, the auto_backup_window and auto_full_backup_window will be ignored

Example Usage

resource "oci_database_db_home" "test_db_home" {
	#Required
	#Optional
	database {
		#Required
		admin_password = var.db_home_database_admin_password

		#Optional
		backup_id = oci_database_backup.test_backup.id
		backup_tde_password = var.db_home_database_backup_tde_password
		character_set = var.db_home_database_character_set
		database_id = oci_database_database.test_database.id
		database_software_image_id = oci_database_database_software_image.test_database_software_image.id
		db_backup_config {

			#Optional
			auto_backup_enabled = var.db_home_database_db_backup_config_auto_backup_enabled
			auto_backup_window = var.db_home_database_db_backup_config_auto_backup_window
			auto_full_backup_day = var.db_home_database_db_backup_config_auto_full_backup_day
			auto_full_backup_window = var.db_home_database_db_backup_config_auto_full_backup_window
			backup_deletion_policy = var.db_home_database_db_backup_config_backup_deletion_policy
			backup_destination_details {

				#Optional
				dbrs_policy_id = oci_identity_policy.test_policy.id
				id = var.db_home_database_db_backup_config_backup_destination_details_id
				type = var.db_home_database_db_backup_config_backup_destination_details_type
			}
			recovery_window_in_days = var.db_home_database_db_backup_config_recovery_window_in_days
			run_immediate_full_backup = var.db_home_database_db_backup_config_run_immediate_full_backup
		}
		db_name = var.db_home_database_db_name
		db_workload = var.db_home_database_db_workload
		defined_tags = var.db_home_database_defined_tags
		freeform_tags = var.db_home_database_freeform_tags
		key_store_id = oci_database_key_store.test_key_store.id
		kms_key_id = oci_kms_key.test_key.id
		kms_key_version_id = oci_kms_key_version.test_key_version.id
		ncharacter_set = var.db_home_database_ncharacter_set
		pdb_name = var.db_home_database_pdb_name
		pluggable_databases = var.db_home_database_pluggable_databases
		sid_prefix = var.db_home_database_sid_prefix
		tde_wallet_password = var.db_home_database_tde_wallet_password
		time_stamp_for_point_in_time_recovery = var.db_home_database_time_stamp_for_point_in_time_recovery
		vault_id = oci_kms_vault.test_vault.id
	}
	database_software_image_id = oci_database_database_software_image.test_database_software_image.id
	db_system_id = oci_database_db_system.test_db_system.id
	db_version {
	}
	defined_tags = var.db_home_defined_tags
	display_name = var.db_home_display_name
    enable_database_delete = false
	freeform_tags = {"Department"= "Finance"}
	is_desupported_version = var.db_home_is_desupported_version
	is_unified_auditing_enabled = var.db_home_is_unified_auditing_enabled
	kms_key_id = oci_kms_key.test_key.id
	kms_key_version_id = oci_kms_key_version.test_key_version.id
	source = var.db_home_source
	vm_cluster_id = oci_database_vm_cluster.test_vm_cluster.id
}

Argument Reference

The following arguments are supported:

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain operations: * create - (Defaults to 12 hours), when creating the Db Home * update - (Defaults to 2 hours), when updating the Db Home * delete - (Defaults to 2 hours), when destroying the Db Home

Import

DbHomes can be imported using the id, e.g.

$ terraform import oci_database_db_home.test_db_home "id"

Import is only supported for source=NONE

database.0.admin_password is not returned by the service for security reasons. Add the following to the resource:

    lifecycle {
        ignore_changes = ["database.0.admin_password"]
    }

The creation of an oci_database_db_system requires that it be created with exactly one oci_database_db_home. Therefore the first db home will have to be a property of the db system resource and any further db homes to be added to the db system will have to be added as first class resources using “oci_database_db_home”.