oracle-terraform-modules / terraform-oci-oke

The Terraform OKE Module Installer for Oracle Cloud Infrastructure provides a Terraform module that provisions the necessary resources for Oracle Container Engine.
https://oracle-terraform-modules.github.io/terraform-oci-oke/
Universal Permissive License v1.0
153 stars 206 forks source link

Add Support for Resource Manager #905

Closed MarcGueury closed 6 months ago

MarcGueury commented 6 months ago

Community Note

Description

The same works without OCI Resource Manager.

I am not able to use the module with Resource Manager due to 2 reasons: 1) when using the module as a reference to my yaml file. There is this error:

The local name "oci.home" in the root module represents provider hashicorp/oci", but ""oci.home"" in module.oke represents ""oracle/oci".

2) when downloading the full repository and applying it, there is this error:

-> Invalid Terraform version specified in the Terraform configuration file: >= 1.3.0. Update the configuration file to specify a supported Terraform version.

The max version of Resource Manager seems to be 1.2.x...

New or Affected Resource(s)

-

Potential Terraform Configuration

variable "tenancy_id" {}
variable "region" {}
variable "compartment_id" {}

terraform {
  required_version = ">=1.2.0"
  required_providers {
    oci = {
      source  = "oracle/oci"
    }
  }
}

provider "oci" {
  alias        = "home2"
  auth         = "SecurityToken"
  config_file_profile = "DEFAULT"
  region       = var.region
}

module "oke" {
  source  = "oracle-terraform-modules/oke/oci"
  version = "5.1.0"

  home_region = var.region
  region      = var.region
  ssh_private_key_path = "/home/opc/data/lz/tfok2/ssh_key_starter"
  ssh_public_key_path = "/home/opc/data/lz/tfok2/ssh_key_starter.pub"

  tenancy_id = var.tenancy_id

  # general oci parameters
  compartment_id = var.compartment_id

  worker_disable_default_cloud_init = true
  bastion_allowed_cidrs       = [ "0.0.0.0/0" ]

  providers = {
    oci.home = oci.home2
  }
}

I can upload also a zip file that fails if it helps.

MarcGueury commented 6 months ago

tfok2.zip Upload this file in OCI Resource Manager and it will fail...

robo-cap commented 6 months ago

This module is using features available in terraform starting with version 1.3.0. If you are looking for a deployment through ORM, you can use this source: https://github.com/robo-cap/terraform-oci-oke/tree/sav

module "oke" {
  source  = "git::https://github.com/robo-cap/terraform-oci-oke.git?ref=205e509"
...
}

The current latest Terraform version available for ORM is 1.2.0.

MarcGueury commented 6 months ago

Thanks, forgot to say that there is a WA (thanks Alberto) it is to use a branch for 1.2 like this:

module "oke" {
  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

  # Identity
  create_iam_resources = false
  create_iam_tag_namespace = false
  create_iam_defined_tags = false
  use_defined_tags = false
  ...

Then it works perfectly.

hyder commented 6 months ago

Resolved in #907