oci_database_database

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

Creates a new database in the specified Database Home. If the database version is provided, it must match the version of the Database Home. Applies only to Exadata systems.

Example Usage

resource "oci_database_database" "test_database" {
	#Required
	database {

		#Optional
		admin_password = var.database_database_admin_password
		backup_id = oci_database_backup.test_backup.id
		backup_tde_password = var.database_database_backup_tde_password
		character_set = var.database_database_character_set
		database_admin_password = var.database_database_database_admin_password
		database_software_image_id = oci_database_database_software_image.test_database_software_image.id
		db_backup_config {

			#Optional
			auto_backup_enabled = var.database_database_db_backup_config_auto_backup_enabled
			auto_backup_window = var.database_database_db_backup_config_auto_backup_window
			auto_full_backup_day = var.database_database_db_backup_config_auto_full_backup_day
			auto_full_backup_window = var.database_database_db_backup_config_auto_full_backup_window
			backup_deletion_policy = var.database_database_db_backup_config_backup_deletion_policy
			backup_destination_details {

				#Optional
				backup_retention_policy_on_terminate = var.database_database_db_backup_config_backup_destination_details_backup_retention_policy_on_terminate
				dbrs_policy_id = oci_identity_policy.test_policy.id
				id = var.database_database_db_backup_config_backup_destination_details_id
				is_remote = var.database_database_db_backup_config_backup_destination_details_is_remote
				is_retention_lock_enabled = var.database_database_db_backup_config_backup_destination_details_is_retention_lock_enabled
				remote_region = var.database_database_db_backup_config_backup_destination_details_remote_region
				type = var.database_database_db_backup_config_backup_destination_details_type
			}
			recovery_window_in_days = var.database_database_db_backup_config_recovery_window_in_days
			run_immediate_full_backup = var.database_database_db_backup_config_run_immediate_full_backup
		}
		db_name = var.database_database_db_name
		db_unique_name = var.database_database_db_unique_name
		db_workload = var.database_database_db_workload
		defined_tags = var.database_database_defined_tags
		encryption_key_location_details {
			#Required
			provider_type = var.database_database_encryption_key_location_details_provider_type

			#Optional
			azure_encryption_key_id = oci_kms_key.test_key.id
			hsm_password = var.database_database_encryption_key_location_details_hsm_password
		}
		freeform_tags = var.database_database_freeform_tags
		is_active_data_guard_enabled = var.database_database_is_active_data_guard_enabled
		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.database_database_ncharacter_set
		pdb_name = var.database_database_pdb_name
		pluggable_databases = var.database_database_pluggable_databases
		protection_mode = var.database_database_protection_mode
		sid_prefix = var.database_database_sid_prefix
		source_database_id = oci_database_database.test_database.id
		source_encryption_key_location_details {
			#Required
			provider_type = var.database_database_source_encryption_key_location_details_provider_type

			#Optional
			azure_encryption_key_id = oci_kms_key.test_key.id
			hsm_password = var.database_database_source_encryption_key_location_details_hsm_password
		}
		
		storage_size_details {
			#Required
			data_storage_size_in_gb = var.database_database_storage_size_details_data_storage_size_in_gb
			reco_storage_size_in_gbs = var.database_database_storage_size_details_reco_storage_size_in_gbs
		}
		source_tde_wallet_password = var.database_database_source_tde_wallet_password
		tde_wallet_password = var.database_database_tde_wallet_password
		transport_type = var.database_database_transport_type
		vault_id = oci_kms_vault.test_vault.id
	}
	db_home_id = oci_database_db_home.test_db_home.id
	source = var.database_source

	#Optional
	db_version = var.database_db_version
	kms_key_id = oci_kms_key.test_key.id
	kms_key_version_id = oci_kms_key_version.test_key_version.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 20 minutes), when creating the Database * update - (Defaults to 20 minutes), when updating the Database * delete - (Defaults to 20 minutes), when destroying the Database

Import

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

$ terraform import oci_database_database.test_database "id"