Skip to content

Iopanait develop38 #100

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

Merged
merged 2 commits into from
Jul 3, 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
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,14 @@ resource "oci_bds_bds_instance" "this" {
# }
# }
# }
# }
# }

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ resource "oci_database_autonomous_database" "adw" {
operations_insights_status = each.value.operations_insights_status
database_management_status = each.value.database_management_status
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright © 2024, 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_datacatalog_catalog" "this" {
for_each = var.datacatalog_params
compartment_id = each.value.compartment_id
display_name = each.value.catalog_display_name
defined_tags = each.value.defined_tags
}

resource "oci_datacatalog_data_asset" "this" {
for_each = var.datacatalog_params
catalog_id = oci_datacatalog_catalog.this[each.key].id
display_name = each.value.catalog_display_name
type_key = data.oci_datacatalog_catalog_types.this[each.key].type_collection[0].items[0].key
properties = {
"default.database" = var.db_name
"default.privateendpoint" = "false"
}
}

data "oci_datacatalog_catalog_types" "this" {
for_each = var.datacatalog_params
catalog_id = oci_datacatalog_catalog.this[each.key].id
type_category = "dataAsset"
name = "Autonomous Data Warehouse"
state = "ACTIVE"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright © 2024, 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 "datacatalog" {
value = {
for datacatalog in oci_datacatalog_catalog.this:
datacatalog.display_name => datacatalog.display_name
}
}

output "datacatalog_data_asset" {
value = {
for datacatalog_data_asset in oci_datacatalog_data_asset.this:
datacatalog_data_asset.display_name => datacatalog_data_asset.display_name
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright © 2024, 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 "datacatalog_params" {
type = map(object({
compartment_id = string
catalog_display_name = string
defined_tags = map(string)
}))
}

variable "db_name" {
type = string
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ resource "oci_core_instance" "instance" {
ignore_changes = all
}
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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.

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


resource "oci_core_instance" "instance" {

for_each = var.instance_params

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

defined_tags = each.value.defined_tags
freeform_tags = each.value.freeform_tags

create_vnic_details {
subnet_id = each.value.subnet_id
display_name = each.value.vnic_display_name
assign_public_ip = each.value.assign_public_ip
hostname_label = each.value.hostname_label
}

source_details {
source_type = each.value.source_type
source_id = each.value.source_id
boot_volume_size_in_gbs = each.value.boot_volume_size_in_gbs
}

metadata = each.value.metadata

fault_domain = each.value.fault_domain

timeouts {
create = "${each.value.provisioning_timeout_mins}m"
}

#prevent any metadata changes to destroy instance
# lifecycle {
# ignore_changes = [metadata, shape, shape_config]
# }
lifecycle {
ignore_changes = all
}
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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.

# Output the private and public IPs of the instance

output "InstancePrivateIPs" {
value = [ for b in oci_core_instance.instance : b.private_ip]
}

output "InstancePublicIPs" {
value = [ for b in oci_core_instance.instance : b.public_ip]
}

output "InstanceOcids" {
value = [ for b in oci_core_instance.instance : b.id]
}

output "display_names" {
value = [ for b in oci_core_instance.instance : b.display_name]
}

output "InstanceShapes" {
value = [ for b in oci_core_instance.instance : b.shape]
}

output "AvailabilityDomains" {
value = [ for b in oci_core_instance.instance : b.availability_domain]
}

locals {
linux_instances = {
for instance in oci_core_instance.instance :
instance.display_name => { "id" : instance.id, "ip" : instance.public_ip != "" ? instance.public_ip : instance.private_ip }
}

linux_ids = {
for instance in oci_core_instance.instance :
instance.display_name => instance.id
}

linux_private_ips = {
for instance in oci_core_instance.instance :
instance.display_name => instance.private_ip
}

linux_public_ips = {
for instance in oci_core_instance.instance :
instance.display_name => instance.public_ip
}

all_instances = local.linux_ids
all_private_ips = local.linux_private_ips
all_public_ips = local.linux_public_ips
}

output "linux_instances" {
value = local.linux_instances
}

output "all_instances" {
value = local.all_instances
}

output "all_private_ips" {
value = local.all_private_ips
}

output "all_public_ips" {
value = local.all_public_ips
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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.

variable "tenancy_ocid" {
type = string
}

variable "instance_params" {

type = map(object({

availability_domain = number
compartment_id = string
display_name = string
shape = string

defined_tags = map(string)
freeform_tags = map(string)

subnet_id = string
vnic_display_name = string
assign_public_ip = string
hostname_label = string

source_type = string
source_id = string
boot_volume_size_in_gbs = number

metadata = map(string)

fault_domain = string

provisioning_timeout_mins = string

}))

}
10 changes: 10 additions & 0 deletions cloud-foundation/modules/cloud-foundation-library/keygen/keygen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ resource "tls_self_signed_cert" "demo_cert" {
"crl_signing",
]
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ resource "oci_objectstorage_bucket" "os" {
object_events_enabled = each.value.events_enabled
defined_tags = each.value.defined_tags
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ resource "oci_data_safe_data_safe_private_endpoint" "this" {
defined_tags = each.value.defined_tags
description = each.value.description
nsg_ids = each.value.nsg_ids
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,13 @@ resource "oci_events_rule" "this" {
freeform_tags = each.value.freeform_tags
}


terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ resource "oci_log_analytics_log_analytics_log_group" "this" {
namespace = data.oci_identity_tenancy.this.name
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ resource "oci_logging_log" "this" {
is_enabled = each.value.is_enabled
retention_duration = each.value.retention_duration
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@ resource "oci_sch_service_connector" "this" {
}
}
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ resource "oci_monitoring_alarm" "this" {
}
}
}

terraform {
required_providers {
oci = {
source = "oracle/oci"
version = ">= 5.30.0"
}
}
required_version = ">= 1.5.5"
}
Loading