Skip to content

Commit

Permalink
fix: TF12 module_variable_optional_attrs compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Devon Crouse <devon.crouse@oracle.com>
  • Loading branch information
devoncrouse committed Aug 17, 2023
1 parent 8b8a35e commit f1dddd3
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 19 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/mdbook.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Publish Documentation
on:
push:
branches:
- "5.x"
- "5.x-*"
branches: ["5.x"]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/rms.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Terraform OCI OKE RMS Stacks
on:
push:
branches:
- "5.x-tf12"
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "rms"
cancel-in-progress: false

jobs:
network-only:
environment:
name: rms
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create archive
working-directory: ./examples/rms
run: zip -r tfoke-rms-network-only.zip ./oke-network-only
- uses: actions/upload-artifact@v3
with:
name: tfoke-rms-network-only.zip
path: ./examples/rms/tfoke-rms-network-only.zip
retention-days: 90
if-no-files-found: error

cluster-only:
environment:
name: rms
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create archive
working-directory: ./examples/rms
run: zip -r tfoke-rms-cluster-only.zip ./oke-cluster-only
- uses: actions/upload-artifact@v3
with:
name: tfoke-rms-cluster-only.zip
path: ./examples/rms/tfoke-rms-cluster-only.zip
retention-days: 90
if-no-files-found: error

workers-only:
environment:
name: rms
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create archive
working-directory: ./examples/rms
run: zip -r tfoke-rms-workers-only.zip ./oke-workers-only
- uses: actions/upload-artifact@v3
with:
name: tfoke-rms-workers-only.zip
path: ./examples/rms/tfoke-rms-workers-only.zip
retention-days: 90
if-no-files-found: error

2 changes: 1 addition & 1 deletion docs/src/guide/rms_instance.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://objectstorage.ap-osaka-1.oraclecloud.com/p/VYW4Rc8Q57asWu1DeqUrLkBZ7CMuNe6TsQdCfIsBUEMSLtH6a3zVD5zEwteRYlLW/n/hpc_limited_availability/b/tfoke/o/oke-workers-only.zip&zipUrlVariables={"worker_pool_mode":"Instances","worker_pool_name":"oke-instances"})
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://objectstorage.ap-osaka-1.oraclecloud.com/p/VYW4Rc8Q57asWu1DeqUrLkBZ7CMuNe6TsQdCfIsBUEMSLtH6a3zVD5zEwteRYlLW/n/hpc_limited_availability/b/tfoke/o/oke-workers-only.zip&zipUrlVariables={"worker_pool_mode":"Instance","worker_pool_name":"oke-instances"})

<p>
A set of self-managed Compute Instances for custom user-provisioned worker nodes not managed by an OCI pool, but individually by Terraform.
Expand Down
2 changes: 1 addition & 1 deletion examples/rms/oke-cluster-only/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data "oci_secrets_secretbundle" "ocir" {
}

module "oke" {
source = "github.com/oracle-terraform-modules/terraform-oci-oke.git?ref=5.x&depth=1"
source = "github.com/oracle-terraform-modules/terraform-oci-oke.git?ref=5.x-tf12&depth=1"
providers = { oci.home = oci.home }
tenancy_id = var.tenancy_ocid
compartment_id = var.compartment_ocid
Expand Down
2 changes: 1 addition & 1 deletion examples/rms/oke-network-only/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

module "oke" {
source = "github.com/oracle-terraform-modules/terraform-oci-oke.git?ref=5.x&depth=1"
source = "github.com/oracle-terraform-modules/terraform-oci-oke.git?ref=5.x&-tf12depth=1"
providers = { oci.home = oci.home }
tenancy_id = var.tenancy_ocid
compartment_id = var.compartment_ocid
Expand Down
6 changes: 3 additions & 3 deletions examples/rms/oke-workers-only/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
}

module "oke" {
source = "github.com/oracle-terraform-modules/terraform-oci-oke.git?ref=5.x&depth=1"
source = "github.com/oracle-terraform-modules/terraform-oci-oke.git?ref=5.x-tf12&depth=1"
providers = { oci.home = oci.home }

# Identity
Expand Down Expand Up @@ -53,7 +53,7 @@ module "oke" {
worker_pool_size = var.worker_pool_size
worker_pool_mode = lookup({
"Node Pool" = "node-pool"
"Instances" = "instances"
"Instance" = "instances"
"Instance Pool" = "instance-pool",
"Cluster Network" = "cluster-network",
}, var.worker_pool_mode, "node-pool")
Expand All @@ -75,7 +75,7 @@ module "oke" {
format("%v", var.worker_pool_name) = {
description = lookup({
"Node Pool" = "OKE-managed Node Pool"
"Instances" = "Self-managed Instances"
"Instance" = "Self-managed Instances"
"Instance Pool" = "Self-managed Instance Pool"
"Cluster Network" = "Self-managed Cluster Network"
}, var.worker_pool_mode, "")
Expand Down
5 changes: 1 addition & 4 deletions examples/rms/oke-workers-only/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ output "worker_image_id" { value = local.worker_image_id }
output "autoscale" { value = var.autoscale }

output "worker_pool_ids" {
value = concat(
values(coalesce(module.oke.worker_pool_ids, {})),
values(coalesce(module.oke.worker_instance_ids, {})),
)
value = try(values(coalesce(module.oke.worker_pool_ids, {})), null)
}
2 changes: 1 addition & 1 deletion examples/rms/oke-workers-only/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ variables:
description: Type of Oracle Cloud Compute resources for the created worker nodes.
type: enum
default: Instance Pool
enum: [Node Pool, Instances, Instance Pool, Cluster Network]
enum: [Node Pool, Instance, Instance Pool, Cluster Network]
required: true
worker_pool_size:
title: Number of worker nodes
Expand Down
6 changes: 3 additions & 3 deletions examples/rms/oke-workers-only/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ variable "kubernetes_version" {

# Worker pools
variable "worker_pool_mode" {
default = "Instances"
default = "Instance"
type = string
validation {
condition = contains(["Node Pool", "Instances", "Instance Pool", "Cluster Network"], var.worker_pool_mode)
error_message = "Accepted values are Node Pool, Instances, Instance Pool, or Cluster Network"
condition = contains(["Node Pool", "Instance", "Instance Pool", "Cluster Network"], var.worker_pool_mode)
error_message = "Accepted values are Node Pool, Instance, Instance Pool, or Cluster Network"
}
}
variable "worker_pool_size" {
Expand Down
1 change: 1 addition & 0 deletions modules/bastion/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

terraform {
experiments = [module_variable_optional_attrs]
required_version = ">= 1.2.0"

required_providers {
Expand Down
1 change: 1 addition & 0 deletions modules/extensions/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

terraform {
experiments = [module_variable_optional_attrs]
required_version = ">= 1.2.0"

required_providers {
Expand Down
1 change: 1 addition & 0 deletions modules/operator/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

terraform {
experiments = [module_variable_optional_attrs]
required_version = ">= 1.2.0"

required_providers {
Expand Down
1 change: 1 addition & 0 deletions modules/utilities/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

terraform {
experiments = [module_variable_optional_attrs]
required_version = ">= 1.2.0"

required_providers {
Expand Down
3 changes: 2 additions & 1 deletion modules/workers/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

terraform {
required_version = ">= 1.3.0"
experiments = [module_variable_optional_attrs]
required_version = ">= 1.2.0"

required_providers {
cloudinit = {
Expand Down
3 changes: 2 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

terraform {
required_version = ">= 1.3.0"
experiments = [module_variable_optional_attrs]
required_version = ">= 1.2.0"

required_providers {
cloudinit = {
Expand Down

0 comments on commit f1dddd3

Please sign in to comment.