Skip to content

Commit

Permalink
added new reference architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelpanaitescu committed Jul 27, 2023
1 parent cd12fca commit 106b51e
Show file tree
Hide file tree
Showing 35 changed files with 4,342 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

resource "oci_database_cloud_vm_cluster" "this" {
for_each = var.cloud_vm_cluster
backup_subnet_id = each.value.backup_subnet_id
cloud_exadata_infrastructure_id = each.value.cloud_exadata_infrastructure_id
compartment_id = each.value.compartment_id
cpu_core_count = each.value.cpu_core_count
display_name = each.value.display_name
gi_version = each.value.gi_version
hostname = each.value.hostname
ssh_public_keys = each.value.ssh_public_keys
subnet_id = each.value.subnet_id
cluster_name = each.value.cluster_name
data_storage_percentage = each.value.data_storage_percentage
defined_tags = each.value.defined_tags
domain = each.value.domain
freeform_tags = each.value.freeform_tags
is_local_backup_enabled = each.value.is_local_backup_enabled
is_sparse_diskgroup_enabled = each.value.is_sparse_diskgroup_enabled
license_model = each.value.license_model
nsg_ids = each.value.nsg_ids
scan_listener_port_tcp = each.value.scan_listener_port_tcp
scan_listener_port_tcp_ssl = each.value.scan_listener_port_tcp_ssl
time_zone = each.value.time_zone
lifecycle {
ignore_changes = all
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

output "cloud_vm_cluster_informations" {
description = "Cloud VM Cluster informations."
value = length(oci_database_cloud_vm_cluster.this) > 0 ? oci_database_cloud_vm_cluster.this[*] : null
}

output "cloud_vm_cluster_id" {
value = [for b in oci_database_cloud_vm_cluster.this : b.id]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

variable "cloud_vm_cluster" {
type = map(object({
backup_subnet_id = string
cloud_exadata_infrastructure_id = string
compartment_id = string
cpu_core_count = number
display_name = string
gi_version = string
hostname = string
ssh_public_keys = list(string)
subnet_id = string
cluster_name = string
data_storage_percentage = number
defined_tags = map(string)
domain = string
freeform_tags = map(string)
is_local_backup_enabled = string
is_sparse_diskgroup_enabled = string
license_model = string
nsg_ids = list(string)
scan_listener_port_tcp = number
scan_listener_port_tcp_ssl = number
time_zone = string
}))
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

data "oci_database_databases" "this" {
compartment_id = var.compartment_id
db_home_id = var.db_home_id
}

resource "oci_database_data_guard_association" "this" {
for_each = var.database_data_guard_association
creation_type = each.value.creation_type
database_admin_password = each.value.database_admin_password
database_id = data.oci_database_databases.this.databases[0].id
delete_standby_db_home_on_delete = each.value.delete_standby_db_home_on_delete
peer_vm_cluster_id = each.value.peer_vm_cluster_id
protection_mode = each.value.protection_mode
transport_type = each.value.transport_type
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

output "exadata_infrastructure_informations" {
description = "Exadata Infrastructure informations."
value = length(oci_database_data_guard_association.this) > 0 ? oci_database_data_guard_association.this[*] : null
}

output "database_data_guard_association" {
value = {for s in oci_database_data_guard_association.this : s.display_name => s}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

variable "compartment_id" {
type = string
}

variable "db_home_id" {
type = string
}

variable "database_data_guard_association" {
type = map(object({
creation_type = string
database_admin_password = string
delete_standby_db_home_on_delete = bool
peer_vm_cluster_id = string
protection_mode = string
transport_type = string
}))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

resource "oci_database_db_home" "this" {
for_each = var.database_db_home
database {
admin_password = each.value.admin_password
defined_tags = each.value.defined_tags
freeform_tags = each.value.freeform_tags
db_name = each.value.db_name
}
db_version = each.value.db_version
display_name = each.value.display_name
source = each.value.source
vm_cluster_id = each.value.vm_cluster_id
lifecycle {
ignore_changes = all
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

output "database_db_home" {
description = "Database DB HOME informations."
value = length(oci_database_db_home.this) > 0 ? oci_database_db_home.this[*] : null
}

output "db_home_id" {
value = [ for b in oci_database_db_home.this : b.id]
}

output "db_system_id" {
value = join(", ", [for b in oci_database_db_home.this : b.id])
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

variable "database_db_home" {
type = map(object({
admin_password = string
defined_tags = map(string)
freeform_tags = map(string)
db_version = string
display_name = string
db_name = string
source = string
vm_cluster_id = string
}))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

data "oci_identity_availability_domains" "ADs" {
compartment_id = var.tenancy_ocid
}

resource "oci_database_cloud_exadata_infrastructure" "this" {
for_each = var.exadata_infrastructure
availability_domain = data.oci_identity_availability_domains.ADs.availability_domains[each.value.availability_domain - 1].name
compartment_id = each.value.compartment_id
display_name = each.value.display_name
shape = each.value.shape
customer_contacts {
email = each.value.email
}
defined_tags = each.value.defined_tags
freeform_tags = each.value.freeform_tags
maintenance_window {
hours_of_day = each.value.hours_of_day
preference = each.value.preference
weeks_of_month = each.value.weeks_of_month
}
lifecycle {
ignore_changes = all
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

output "exadata_infrastructure_informations" {
description = "Exadata Infrastructure informations."
value = length(oci_database_cloud_exadata_infrastructure.this) > 0 ? oci_database_cloud_exadata_infrastructure.this[*] : null
}

output "cloud_exadata_infrastructure_id" {
value = [ for b in oci_database_cloud_exadata_infrastructure.this : b.id]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

variable "tenancy_ocid" {
type = string
}

variable "exadata_infrastructure" {
type = map(object({
availability_domain = number
compartment_id = string
display_name = string
shape = string
email = string
defined_tags = map(string)
freeform_tags = map(string)
hours_of_day = list(number)
preference = string
weeks_of_month = list(number)
}))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

resource "oci_core_drg" "requestor_drg" {
count = var.requestor_region == var.acceptor_region ? 0 : 1
provider = oci.requestor
compartment_id = var.compartment_id
}

resource "oci_core_drg_attachment" "requestor_drg_attachment" {
count = var.requestor_region == var.acceptor_region ? 0 : 1
provider = oci.requestor
drg_id = oci_core_drg.requestor_drg[0].id
vcn_id = var.vcns[var.rpg_params[count.index].vcn_name_requestor].id
}

resource "oci_core_remote_peering_connection" "requestor" {
count = var.requestor_region == var.acceptor_region ? 0 : 1
provider = oci.requestor
compartment_id = var.compartment_id
drg_id = oci_core_drg.requestor_drg[0].id
display_name = "remotePeeringConnectionRequestor"
peer_id = oci_core_remote_peering_connection.acceptor[0].id
peer_region_name = var.acceptor_region
}

resource "oci_core_drg" "acceptor_drg" {
count = var.requestor_region == var.acceptor_region ? 0 : 1
provider = oci.acceptor
compartment_id = var.compartment_id
}

resource "oci_core_drg_attachment" "acceptor_drg_attachment" {
count = var.requestor_region == var.acceptor_region ? 0 : 1
provider = oci.acceptor
drg_id = oci_core_drg.acceptor_drg[0].id
vcn_id = var.vcns2[var.rpg_params[count.index].vcn_name_acceptor].id
}

resource "oci_core_remote_peering_connection" "acceptor" {
count = var.requestor_region == var.acceptor_region ? 0 : 1
provider = oci.acceptor
compartment_id = var.compartment_id
drg_id = oci_core_drg.acceptor_drg[0].id
display_name = "remotePeeringConnectionAcceptor"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

output "requestor" {
value = oci_core_drg.requestor_drg[0].id
}


output "acceptor" {
value = oci_core_drg.acceptor_drg[0].id
}

output "Remote_Peeting_Region1" {
value = length(oci_core_remote_peering_connection.requestor) > 0 ? oci_core_remote_peering_connection.requestor[*] : null
}

output "Remote_Peeting_Region2" {
value = length(oci_core_remote_peering_connection.acceptor) > 0 ? oci_core_remote_peering_connection.acceptor[*] : null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

variable "compartment_id" {
type = string
}

variable "vcns" {
description = "The list of vnc's"
type = map(map(string))
}

variable "vcns2" {
description = "The list of vnc's"
type = map(map(string))
}

variable "rpg_params" {
description = "The parameters for the DRG"
type = list(object({
vcn_name_requestor = string
vcn_name_acceptor = string
}))
}

variable "requestor_region" {}
variable "acceptor_region" {}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ output "subnets_ids" {
subnet.display_name => subnet.id
}
}

output "vcnss" {
value = {
for vcn in oci_core_vcn.these :
vcn.display_name => tomap({"id" = vcn.id, "cidr" = vcn.cidr_block})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright © 2022, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

.terraform
*tfstate*
*.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.
-->
# Contributing to Oracle Cloud Foundation Terraform Framework

## Contributing to Oracle Cloud Foundation Terraform Framework

Oracle welcomes contributions to this repository from anyone.

If you want to submit a pull request to fix a bug or enhance an existing
feature, please first open an issue and link to that issue when you
submit your pull request.

If you have any questions about a possible submission, feel free to open
an issue too.

## Pull request process

1. Fork this repository
1. Create a branch in your fork to implement the changes. We recommend using
the issue number as part of your branch name, e.g. `1234-fixes`
1. Ensure that there is at least one test that would fail without the fix and
passes post fix
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
what your changes are meant to do and provide simple steps on how to validate
your changes, ideally referencing the test. Ensure that you reference the issue
you created as well. We will assign the pull request to 1-2 people for review
before it is submitted internally and the PR is closed.
Loading

0 comments on commit 106b51e

Please sign in to comment.