oci_opsi_database_insight
This resource provides the Database Insight resource in Oracle Cloud Infrastructure Opsi service. Api doc link for the resource: https://docs.oracle.com/iaas/api/#/en/operations-insights/latest/DatabaseInsight
Example terraform configs related to the resource : https://github.com/oracle/terraform-provider-oci/tree/master/examples/osi
Create a Database Insight resource for a Enterprise Manager(EM) managed database in Operations Insights. The database will be enabled in Operations Insights. Database metric collection and analysis will be started. The Database Insight resource for Autonomous Database and Management Agent managed external Database needs to be created by Database service terraform provider.
Example Usage
resource "oci_opsi_database_insight" "test_database_insight" {
	#Required
	compartment_id = var.compartment_id
	database_id = oci_database_database.test_database.id
	database_resource_type = var.database_insight_database_resource_type
	entity_source = var.database_insight_entity_source
	#Optional
	connection_credential_details {
		#Required
		credential_type = var.database_insight_connection_credential_details_credential_type
		#Optional
		credential_source_name = var.database_insight_connection_credential_details_credential_source_name
		named_credential_id = oci_database_management_named_credential.test_named_credential.id
		password_secret_id = oci_vault_secret.test_secret.id
		role = var.database_insight_connection_credential_details_role
		user_name = oci_identity_user.test_user.name
		wallet_secret_id = oci_vault_secret.test_secret.id
	}
	connection_details {
		#Required
		protocol = var.database_insight_connection_details_protocol
		service_name = oci_core_service.test_service.name
		#Optional
		host_name = var.database_insight_connection_details_host_name
		hosts {
			#Optional
			host_ip = var.database_insight_connection_details_hosts_host_ip
			port = var.database_insight_connection_details_hosts_port
		}
		port = var.database_insight_connection_details_port
	}
	entity_source = var.database_insight_entity_source
	
	credential_details {
		#Required
		credential_source_name = var.database_insight_credential_details_credential_source_name
		credential_type = var.database_insight_credential_details_credential_type
		#Optional
		credential_source_name = var.database_insight_credential_details_credential_source_name
		named_credential_id = oci_database_management_named_credential.test_named_credential.id
		password_secret_id = oci_vault_secret.test_secret.id
		role = var.database_insight_credential_details_role
		user_name = oci_identity_user.test_user.name
		wallet_secret_id = oci_vault_secret.test_secret.id
	}
	database_connector_id = oci_opsi_database_connector.test_database_connector.id
	dbm_private_endpoint_id = oci_dataflow_private_endpoint.test_private_endpoint.id
	defined_tags = {"foo-namespace.bar-key"= "value"}
	deployment_type = var.database_insight_deployment_type
	enterprise_manager_bridge_id = oci_opsi_enterprise_manager_bridge.test_enterprise_manager_bridge.id
	enterprise_manager_entity_identifier = var.database_insight_enterprise_manager_entity_identifier
	enterprise_manager_identifier = var.database_insight_enterprise_manager_identifier
	exadata_insight_id = oci_opsi_exadata_insight.test_exadata_insight.id
	freeform_tags = {"bar-key"= "value"}
	management_agent_id = oci_management_agent_management_agent.test_management_agent.id
	opsi_private_endpoint_id = oci_dataflow_private_endpoint.test_private_endpoint.id
	service_name = oci_core_service.test_service.name
	system_tags = var.database_insight_system_tags
}
Argument Reference
The following arguments are supported:
- compartment_id- (Required) (Updatable) Compartment Identifier of database
- connection_credential_details- (Required when entity_source=MACS_MANAGED_AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE) User credential details to connect to the database.- credential_type- (Required) CREDENTIALS_BY_SOURCE is supplied via the External Database Service. CREDENTIALS_BY_VAULT is supplied by secret service to connection PE_COMANAGED_DATABASE and ADB as well. CREDENTIALS_BY_IAM is used db-token to connect only for Autonomous Database.
- named_credential_id- (Applicable when credential_type=CREDENTIALS_BY_NAMED_CREDS) The credential OCID stored in management agent.
- credential_type- (Required) Credential type.
- password_secret_id- (Applicable when credential_type=CREDENTIALS_BY_VAULT) The secret OCID mapping to the database credentials.
- role- (Applicable when credential_type=CREDENTIALS_BY_VAULT) database user role.
- user_name- (Applicable when credential_type=CREDENTIALS_BY_VAULT) database user name.
- wallet_secret_id- (Applicable when credential_type=CREDENTIALS_BY_VAULT) The OCID of the Secret where the database keystore contents are stored. This is used for TCPS support in BM/VM/ExaCS cases.
 
- connection_details- (Required when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE | PE_COMANAGED_DATABASE) Connection details to connect to the database. HostName, protocol, and port should be specified.- host_name- (Required when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE) Name of the listener host that will be used to create the connect string to the database.
- hosts- (Required when entity_source=PE_COMANAGED_DATABASE) List of hosts and port for private endpoint accessed database resource.- host_ip- (Applicable when entity_source=PE_COMANAGED_DATABASE) Host IP used for connection requests for Cloud DB resource.
- port- (Applicable when entity_source=PE_COMANAGED_DATABASE) Listener port number used for connection requests for rivate endpoint accessed db resource.
 
- port- (Required when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE) Listener port number used for connection requests.
- protocol- (Required when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE | PE_COMANAGED_DATABASE) Protocol used for connection requests for private endpoint accssed database resource.
- service_name- (Required when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE | PE_COMANAGED_DATABASE) Database service name used for connection requests.
 
- credential_details- (Required when entity_source=AUTONOMOUS_DATABASE | PE_COMANAGED_DATABASE) User credential details to connect to the database.- credential_source_name- (Applicable when entity_source=EM_MANAGED_EXTERNAL_DATABASE) Credential source name that had been added in Management Agent wallet. This value is only required when credential set by CREDENTIALS_BY_SOURCE and is optional properties for the others.
- credential_type- (Required) CREDENTIALS_BY_SOURCE is supplied via the External Database Service. CREDENTIALS_BY_VAULT is supplied by secret service to connection PE_COMANAGED_DATABASE and ADB as well. CREDENTIALS_BY_IAM is used db-token to connect only for Autonomous Database.
- named_credential_id- (Applicable when credential_type=CREDENTIALS_BY_NAMED_CREDS) The credential OCID stored in the Management Agent to connect the Autonomous Database.
- password_secret_id- (Applicable when credential_type=CREDENTIALS_BY_VAULT) The secret OCID mapping to the database credentials.
- role- (Applicable when credential_type=CREDENTIALS_BY_VAULT) database user role.
- user_name- (Applicable when credential_type=CREDENTIALS_BY_VAULT) database user name.
- wallet_secret_id- (Applicable when credential_type=CREDENTIALS_BY_VAULT) The OCID of the Secret where the database keystore contents are stored. This is used for TCPS support in BM/VM/ExaCS cases.
 
- database_connector_id- (Required when entity_source=EXTERNAL_MYSQL_DATABASE_SYSTEM) (Updatable) The DBM owned database connector OCID mapping to the database credentials and connection details.
- database_id- (Required when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE | MDS_MYSQL_DATABASE_SYSTEM | PE_COMANAGED_DATABASE | EXTERNAL_MYSQL_DATABASE_SYSTEM) The OCID of the database.
- database_resource_type- (Required when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE | MDS_MYSQL_DATABASE_SYSTEM | PE_COMANAGED_DATABASE) Oracle Cloud Infrastructure database resource type
- dbm_private_endpoint_id- (Applicable when entity_source=PE_COMANAGED_DATABASE) The OCID of the Database Management private endpoint
- defined_tags- (Optional) (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. Example:- {"foo-namespace.bar-key": "value"}
- deployment_type- (Required when entity_source=MACS_MANAGED_CLOUD_DATABASE | PE_COMANAGED_DATABASE) Database Deployment Type (EXACS will be supported in the future)
- enterprise_manager_bridge_id- (Required when entity_source=EM_MANAGED_EXTERNAL_DATABASE) OPSI Enterprise Manager Bridge OCID
- enterprise_manager_entity_identifier- (Required when entity_source=EM_MANAGED_EXTERNAL_DATABASE) Enterprise Manager Entity Unique Identifier
- enterprise_manager_identifier- (Required when entity_source=EM_MANAGED_EXTERNAL_DATABASE) Enterprise Manager Unique Identifier
- entity_source- (Required) (Updatable) Source of the database entity.
- exadata_insight_id- (Applicable when entity_source=EM_MANAGED_EXTERNAL_DATABASE) The OCID of the Exadata insight.
- freeform_tags- (Optional) (Updatable) Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example:- {"bar-key": "value"}
- is_advanced_features_enabled- (Required when entity_source=AUTONOMOUS_DATABASE) Flag is to identify if advanced features for autonomous database is enabled or not
- management_agent_id- (Required when entity_source=MACS_MANAGED_AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | MACS_MANAGED_EXTERNAL_DATABASE) The OCID of the Management Agent
- opsi_private_endpoint_id- (Applicable when entity_source=AUTONOMOUS_DATABASE | PE_COMANAGED_DATABASE) The OCID of the OPSI private endpoint
- dbm_private_endpoint_id- (Applicable when entity_source=PE_COMANAGED_DATABASE) The OCID of the Database Management private endpoint. This field and opsi_private_endpoint_id are mutually exclusive. If DBM private endpoint ID is provided, a new OPSI private endpoint ID will be created.
- service_name- (Required when entity_source=PE_COMANAGED_DATABASE) Database service name used for connection requests.
- system_tags- (Applicable when entity_source=AUTONOMOUS_DATABASE | MACS_MANAGED_AUTONOMOUS_DATABASE | MACS_MANAGED_CLOUD_DATABASE | PE_COMANAGED_DATABASE) System tags for this resource. Each key is predefined and scoped to a namespace. Example:- {"orcl-cloud.free-tier-retained": "true"}
- status- (Optional) (Updatable) Status of the resource. Example: “ENABLED”, “DISABLED”. Resource can be either enabled or disabled by updating the value of status field to either “ENABLED” or “DISABLED”
** 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. The resource destruction here is basically a soft delete. User cannot create resource using the same EM managed bridge OCID. If resource is in enabled state during destruction, the resource will be disabled automatically before performing delete operation.
Attributes Reference
The following attributes are exported:
- compartment_id- Compartment identifier of the database
- connection_credential_details- User credential details to connect to the database.- credential_source_name- Credential source name that had been added in Management Agent wallet. This value is only required when Credential set by CREDENTIALS_BY_SOURCE and is optional properties for ther others.
- credential_type- CREDENTIALS_BY_SOURCE is supplied via the External Database Service. CREDENTIALS_BY_VAULT is supplied by secret service to connection PE_COMANAGED_DATABASE and ADB as well. CREDENTIALS_BY_IAM is used db-token to connect only for Autonomous Database.
- named_credential_id- The credential OCID stored in management agent.
- password_secret_id- The secret OCID mapping to the database credentials.
- role- database user role.
- user_name- database user name.
- wallet_secret_id- The OCID of the Secret where the database keystore contents are stored. This is used for TCPS support in BM/VM/ExaCS cases.
 
- connection_details- Connection details to connect to the database. HostName, protocol, and port should be specified.- host_name- Name of the listener host that will be used to create the connect string to the database.
- hosts- List of hosts and port for private endpoint accessed database resource.- host_ip- Host IP used for connection requests for Cloud DB resource.
- port- Listener port number used for connection requests for rivate endpoint accessed db resource.
 
- port- Listener port number used for connection requests.
- protocol- Protocol used for connection requests for private endpoint accssed database resource.
- service_name- Database service name used for connection requests.
 
- connector_id- The OCID of External Database Connector
- credential_details- User credential details to connect to the database.- credential_source_name- Credential source name that had been added in Management Agent wallet. This value is only required when Credential set by CREDENTIALS_BY_SOURCE and is optional properties for ther others.
- credential_type- CREDENTIALS_BY_SOURCE is supplied via the External Database Service. CREDENTIALS_BY_VAULT is supplied by secret service to connection PE_COMANAGED_DATABASE and ADB as well. CREDENTIALS_BY_IAM is used db-token to connect only for Autonomous Database.
- named_credential_id- The credential OCID stored in management agent.
- password_secret_id- The secret OCID mapping to the database credentials.
- role- database user role.
- user_name- database user name.
- wallet_secret_id- The OCID of the Secret where the database keystore contents are stored.
 
- database_connection_status_details- A message describing the status of the database connection of this resource. For example, it can be used to provide actionable information about the permission and content validity of the database connection.
- database_display_name- Display name of database
- database_id- The OCID of the database.
- database_name- Name of database
- database_resource_type- Oracle Cloud Infrastructure database resource type
- database_type- Ops Insights internal representation of the database type.
- database_version- The version of the database.
- defined_tags- Defined tags for this resource. Each key is predefined and scoped to a namespace. Example:- {"foo-namespace.bar-key": "value"}
- enterprise_manager_bridge_id- OPSI Enterprise Manager Bridge OCID
- enterprise_manager_entity_display_name- Enterprise Manager Entity Display Name
- enterprise_manager_entity_identifier- Enterprise Manager Entity Unique Identifier
- enterprise_manager_entity_name- Enterprise Manager Entity Name
- enterprise_manager_entity_type- Enterprise Manager Entity Type
- enterprise_manager_identifier- Enterprise Manager Unqiue Identifier
- entity_source- Source of the database entity.
- exadata_insight_id- The OCID of the Exadata insight.
- freeform_tags- Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example:- {"bar-key": "value"}
- id- Database insight identifier
- is_advanced_features_enabled- Flag is to identify if advanced features for autonomous database is enabled or not
- is_heat_wave_cluster_attached- Specifies if MYSQL DB System has heatwave cluster attached.
- is_highly_available- Specifies if MYSQL DB System is highly available.
- lifecycle_details- A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state.
- opsi_private_endpoint_id- The OCID of the OPSI private endpoint
- parent_id- The OCID of the VM Cluster or DB System ID, depending on which configuration the resource belongs to.
- processor_count- Processor count. This is the OCPU count for Autonomous Database and CPU core count for other database types.
- root_id- The OCID of the Exadata Infrastructure.
- state- The current state of the database.
- status- Indicates the status of a database insight in Operations Insights
- system_tags- System tags for this resource. Each key is predefined and scoped to a namespace. Example:- {"orcl-cloud.free-tier-retained": "true"}
- time_created- The time the database insight was first enabled. An RFC3339 formatted datetime string
- time_updated- The time the database insight was updated. An RFC3339 formatted datetime string
Timeouts
The timeouts block allows you to specify timeouts for certain operations:
* create - (Defaults to 20 minutes), when creating the Database Insight
* update - (Defaults to 20 minutes), when updating the Database Insight
* delete - (Defaults to 20 minutes), when destroying the Database Insight
Import
DatabaseInsights can be imported using the id, e.g.
$ terraform import oci_opsi_database_insight.test_database_insight "id"