generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from oracle-devrel/develop
v2024.3.0 TF modules
- Loading branch information
Showing
491 changed files
with
58,069 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/*This line will be removed when using remote state | ||
# !!! WARNING !!! Terraform State Lock is not supported with OCI Object Storage. | ||
# Pre-Requisite: Create a version enabled object storage bucket to store the state file. | ||
# End Point Format: https://<namespace>.compat.objectstorage.<region>.oraclecloud.com | ||
# Please look at the below doc for information about shared_credentials_file and other parameters: | ||
# Reference: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformUsingObjectStore.htm | ||
terraform { | ||
backend "s3" { | ||
key = "<folder/filename.tfstate>" | ||
bucket = "<Object Storage Bucket Name>" | ||
region = "<region>" | ||
endpoint = "<Object Storage Bucket End Point>" | ||
shared_credentials_file = "~/.aws/credentials" | ||
skip_region_validation = true | ||
skip_credentials_validation = true | ||
skip_metadata_api_check = true | ||
force_path_style = true | ||
} | ||
} | ||
This line will be removed when using remote state*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) 2024, Oracle and/or its affiliates. | ||
|
||
############################ | ||
# Module Block - Cost Management | ||
# Create Budgets and Rule Alerts | ||
############################ | ||
|
||
#locals { | ||
# comp_ocids = {for key, val in var.budgets : key => [ | ||
# var.compartment_ocids[flatten([for targets in val.targets : targets])[0]] | ||
# ] if val.target_type == "COMPARTMENT" } | ||
#} | ||
|
||
|
||
|
||
module "budget-alert-rules" { | ||
source = "./modules/costmanagement/budget-alert-rule" | ||
for_each = var.budget_alert_rules | ||
|
||
#Required | ||
budget_id = length(regexall("ocid1.budget.oc*", each.value.budget_id)) > 0 ? each.value.budget_id : merge(module.budgets.*...)[each.value.budget_id]["budget_tf_id"] | ||
threshold = each.value.threshold | ||
threshold_type = each.value.threshold_type | ||
type = each.value.type | ||
|
||
#Optional | ||
description = each.value.description | ||
display_name = each.value.display_name | ||
defined_tags = each.value.defined_tags | ||
freeform_tags = each.value.freeform_tags | ||
message = each.value.message | ||
recipients = each.value.recipients | ||
} | ||
|
||
module "budgets" { | ||
source = "./modules/costmanagement/budget" | ||
for_each = var.budgets | ||
|
||
#Required | ||
amount = each.value.amount | ||
compartment_id = each.value.compartment_id != null ? (length(regexall("ocid1.compartment.oc*", each.value.compartment_id)) > 0 ? each.value.compartment_id : var.compartment_ocids[each.value.compartment_id]):var.tenancy_ocid | ||
|
||
reset_period = each.value.reset_period != null ? each.value.reset_period : "MONTHLY" | ||
|
||
#Optional | ||
budget_processing_period_start_offset = each.value.budget_processing_period_start_offset | ||
description = each.value.description | ||
display_name = each.value.display_name | ||
defined_tags = each.value.defined_tags | ||
freeform_tags = each.value.freeform_tags | ||
processing_period_type = each.value.processing_period_type | ||
budget_start_date = each.value.processing_period_type == "SINGLE_USE" ? each.value.budget_start_date : null | ||
budget_end_date = each.value.processing_period_type == "SINGLE_USE" ? each.value.budget_end_date : null | ||
|
||
#target_compartment_id = each.value.target_compartment_id != null ? (length(regexall("ocid1.compartment.oc*", each.value.target_compartment_id)) > 0 ? each.value.target_compartment_id : var.compartment_ocids[each.value.target_compartment_id]) : null | ||
|
||
target_type = each.value.target_type | ||
#targets = each.value.targets | ||
|
||
targets = each.value.target_type == "COMPARTMENT" ? (length(regexall("ocid1.compartment.oc*", each.value.targets[0])) > 0 ? each.value.targets : [var.compartment_ocids[each.value.targets[0]]]) : each.value.targets | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2021, 2022, Oracle and/or its affiliates. | ||
|
||
############################ | ||
# Resource Block - Identity | ||
# Fetch Compartments | ||
############################ | ||
|
||
#Fetch Compartment Details | ||
data "oci_identity_compartments" "compartments" { | ||
#Required | ||
compartment_id = var.tenancy_ocid | ||
|
||
#Optional | ||
#name = var.compartment_name | ||
access_level = "ANY" | ||
compartment_id_in_subtree = true | ||
state = "ACTIVE" | ||
} | ||
|
||
|
||
############################ | ||
# Data Block - Network | ||
# Fetch ADs | ||
############################ | ||
|
||
data "oci_identity_availability_domains" "availability_domains" { | ||
#Required | ||
compartment_id = var.tenancy_ocid | ||
} | ||
|
||
|
||
/* | ||
output "compartment_id_map" { | ||
description = "Compartment ocid" | ||
// This allows the compartment ID to be retrieved from the resource if it exists, and if not to use the data source. | ||
value = zipmap(data.oci_identity_compartments.compartments.compartments.*.name,data.oci_identity_compartments.compartments.compartments.*.id) | ||
} | ||
output "ads" { | ||
value = data.oci_identity_availability_domains.availability_domains.availability_domains.*.name | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) 2021, 2022, Oracle and/or its affiliates. | ||
|
||
############################ | ||
# Provider Block | ||
# OCI | ||
############################ | ||
|
||
provider "oci" { | ||
tenancy_ocid = var.tenancy_ocid | ||
user_ocid = var.user_ocid | ||
fingerprint = var.fingerprint | ||
private_key_path = var.private_key_path | ||
region = var.region | ||
ignore_defined_tags = ["Oracle-Tags.CreatedBy", "Oracle-Tags.CreatedOn"] | ||
} | ||
|
||
terraform { | ||
required_providers { | ||
oci = { | ||
source = "oracle/oci" | ||
version = "5.40.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.