Skip to content

Commit

Permalink
Merge pull request #108 from mgueury/main
Browse files Browse the repository at this point in the history
LiveLabs GreenButton to ECPU
  • Loading branch information
MarcGueury authored Feb 11, 2025
2 parents c5c851a + d5a5b49 commit 2383e83
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
24 changes: 23 additions & 1 deletion basis/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ if declare -p | grep -q "__TO_FILL__"; then
}

read_ocid() {
while [ "${!1}" == "__TO_FILL__" ]; do
while [ "${!1}" == "__TO_FILL__" ]; do
title "Config - $2 OCID"
read -r -p "Enter your $2 OCID (Format: $3.xxxxx): " response
if [[ $response == $3* ]]; then
export $1=$response
Expand All @@ -51,6 +52,7 @@ if declare -p | grep -q "__TO_FILL__"; then

# DB_PASSWORD
if [ "$TF_VAR_db_password" == "__TO_FILL__" ]; then
title "Config - Database Password"
export REQUEST="Generate password for the database ? (TF_VAR_db_password) ?"
if accept_request; then
echo "Generating password for the database"
Expand Down Expand Up @@ -94,6 +96,7 @@ if declare -p | grep -q "__TO_FILL__"; then

# AUTH_TOKEN
if [ "$TF_VAR_auth_token" == "__TO_FILL__" ]; then
title "Config - Authentication Token"
export REQUEST="Generate OCI Auth token ? (TF_VAR_auth_token) ?"
if accept_request; then
echo "Generating OCI Auth token"
Expand All @@ -104,8 +107,25 @@ if declare -p | grep -q "__TO_FILL__"; then
fi
fi

# LICENSE_MODEL
if [ "$TF_VAR_license_model" == "__TO_FILL__" ]; then
title "Config - License Model"
echo "License Model (TF_VAR_license_model): BRING_YOUR_OWN_LICENSE or LICENSE_INCLUDED"
while [ "${!1}" == "__TO_FILL__" ]; do
read -r -p "Enter BRING_YOUR_OWN_LICENSE or LICENSE_INCLUDED: " response
if [[ $response == "BRING_YOUR_OWN_LICENSE" ]] || [[ $response == "LICENSE_INCLUDED" ]] ; then
export TF_VAR_license_model=$response
store_env_sh TF_VAR_license_model $response
else
echo "Wrong value $response"
echo
fi
done
fi

# OIC_APPID
if [ "$TF_VAR_oic_appid" == "__TO_FILL__" ]; then
title "Config - Oracle Integration Confidential App ID"
export REQUEST="Enter the OIC APPID ? (TF_VAR_oic_appid) ?"
read -r -p "Enter the OIC APPID ? (TF_VAR_oic_appid): " TF_VAR_oic_appid
if [[ "${TF_VAR_oic_appid}" =~ ^.*_APPID$ ]]; then
Expand All @@ -118,6 +138,7 @@ if declare -p | grep -q "__TO_FILL__"; then

# API_KEY
if [ "$TF_VAR_api_key" == "__TO_FILL__" ]; then
title "Config - API Key"
read -r -p "Enter the value of the API_KEY (ex: MY_long_KEY_123456) ? (TF_VAR_api_key) " TF_VAR_api_key
store_env_sh TF_VAR_api_key $TF_VAR_api_key
fi
Expand All @@ -127,6 +148,7 @@ if declare -p | grep -q "__TO_FILL__"; then

# COMPARTMENT_ID
if [ "$TF_VAR_compartment_ocid" == "__TO_FILL__" ]; then
title "Config - Compartment"
export REQUEST="Create a new Compartment ? (<No> will ask to reuse an existing one) ?"
if accept_request; then
echo "Check if 'oci-starter' compartment exists"
Expand Down
12 changes: 6 additions & 6 deletions option/terraform/atp.j2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ resource "oci_database_autonomous_database" "starter_atp" {
admin_password = var.db_password
compartment_id = local.lz_db_cmp_ocid
db_version = "23ai"
cpu_core_count = "1"
data_storage_size_in_tbs = "1"
# ECPU - Issue with LiveLab Green Button (TO FIX!!)
# cpu_core_count = "1"
# data_storage_size_in_tbs = "1"

# ECPU - Issue with LiveLab Green Button
# compute_model = "ECPU"
# compute_count = "2"
# data_storage_size_in_gb = "50"
compute_model = "ECPU"
compute_count = "2"
data_storage_size_in_gb = "128"

# Random name to have several OCI Starter ATP named (starteratpxxxx) on the same Tenancy (Ex: livelabs)
db_name = "${var.prefix}atp${random_string.id.result}"
Expand Down
3 changes: 3 additions & 0 deletions option/terraform/nosql.j2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ resource "oci_identity_domains_dynamic_resource_group" "starter_nosql_dyngroup"
display_name = "${var.prefix}-nosql-dyngroup"
matching_rule = "ANY {instance.compartment.id = '${var.compartment_ocid}', ALL {resource.type = 'fnfunc', resource.compartment.id ='${var.compartment_ocid}'}, ALL {resource.type = 'computecontainerinstance', resource.compartment.id ='${var.compartment_ocid}' }}"
schemas = ["urn:ietf:params:scim:schemas:oracle:idcs:DynamicResourceGroup"]
lifecycle {
ignore_changes = [ schemas ]
}
}

resource "oci_identity_policy" "starter_nosql_policy" {
Expand Down
30 changes: 18 additions & 12 deletions todo_oci_bastion/apex_genai.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,27 @@ locals {
}
resource "oci_identity_domains_dynamic_resource_group" "starter-adb-dyngroup" {
#Required
provider = oci.home
display_name = "${var.prefix}-adb-dyngroup"
idcs_endpoint = local.idcs_url
matching_rule = "ANY{ resource.id = '${oci_database_autonomous_database.starter_atp.id}' }"
schemas = ["urn:ietf:params:scim:schemas:oracle:idcs:DynamicResourceGroup"]
#Required
provider = oci.home
display_name = "${var.prefix}-adb-dyngroup"
idcs_endpoint = local.idcs_url
matching_rule = "ANY{ resource.id = '${oci_database_autonomous_database.starter_atp.id}' }"
schemas = ["urn:ietf:params:scim:schemas:oracle:idcs:DynamicResourceGroup"]
lifecycle {
ignore_changes = [ schemas ]
}
}
resource "oci_identity_domains_dynamic_resource_group" "starter-compute-dyngroup" {
#Required
provider = oci.home
display_name = "${var.prefix}-compute-dyngroup"
idcs_endpoint = local.idcs_url
matching_rule = "ANY{ instance.compartment.id = '${local.lz_app_cmp_ocid}' }"
schemas = ["urn:ietf:params:scim:schemas:oracle:idcs:DynamicResourceGroup"]
#Required
provider = oci.home
display_name = "${var.prefix}-compute-dyngroup"
idcs_endpoint = local.idcs_url
matching_rule = "ANY{ instance.compartment.id = '${local.lz_app_cmp_ocid}' }"
schemas = ["urn:ietf:params:scim:schemas:oracle:idcs:DynamicResourceGroup"]
lifecycle {
ignore_changes = [ schemas ]
}
}
resource "time_sleep" "wait_30_seconds" {
Expand Down

0 comments on commit 2383e83

Please sign in to comment.