Solved

Credentials not found for cloud type 16(OCI) and 4(GCP) in account gcp-account & oci-account.

  • 2 December 2023
  • 2 replies
  • 108 views

Badge


 Hello team,  i hope you are doing well. I'm a fresher ACE certified.

 

I'm trying to setup GCP and OCI aviatrix infrastructure using Terraform Cloud, but i have issue,

Others simple ressource non related to Aviatrix Spoke and Transit GW on GCP and OCI are successfully created, but Aviatrix gcp_account, oci_account, oci_spoke, gcp_spoke, oci_transit, gcp_transit faild. The error is related to gcp and oci credentials, but another ressources are welle created on oci and gcp (classic GCP+OCI terraform Cloud work). any other way to solve so the Aviatrix ressource can be created ?

  1. For GCP creadentials i follow thid documentation with Editor Role: https://read.docs.aviatrix.com/HowTos/CreateGCloudAccount.html
  2. For OCI credentials, i follow this documentations for have OCI API keys: https://read.docs.aviatrix.com/HowTos/oracle-aviatrix-cloud-controller-onboard.html


I then create gcp_account, oci_accoint manually from Aviatrix controller, but oci_spoke, gcp_spoke, oci_transit, gcp_transit still faild. Azure, AWS ressource are well created.

 

Terraform code

# GCP Transit Module
module "gcp_transit_1" {
  source              = "terraform-aviatrix-modules/mc-transit/aviatrix"
  version             = "2.5.1"
  cloud               = "GCP"
  account             = var.gcp_account_name
  region              = var.gcp_transit1_region
  name                = var.gcp_transit1_name
  cidr                = var.gcp_transit1_cidr
  enable_segmentation = true
  ha_gw               = var.transit_ha_enabled
}

# Aviatrix GCP Spoke 1
module "gcp_spoke_1" {
  source         = "terraform-aviatrix-modules/mc-spoke/aviatrix"
  version        = "1.6.6"
  cloud          = "GCP"
  account        = var.gcp_account_name
  region         = var.gcp_spoke1_region
  name           = var.gcp_spoke1_name
  cidr           = var.gcp_spoke1_cidr
  ha_gw          = var.spoke_ha_enabled
  network_domain = aviatrix_segmentation_network_domain.BU1.domain_name
  transit_gw     = module.gcp_transit_1.transit_gateway.gw_name
}

# OCI Transit Module
module "oci_transit_1" {
  source              = "terraform-aviatrix-modules/mc-transit/aviatrix"
  version             = "2.5.1"
  cloud               = "OCI"
  account             = var.oci_account_name
  region              = var.oci_transit1_region
  name                = var.oci_transit1_name
  cidr                = var.oci_transit1_cidr
  enable_segmentation = true
  ha_gw               = var.transit_ha_enabled
}

# Aviatrix OCI Spoke 1
module "oci_spoke_1" {
  source         = "terraform-aviatrix-modules/mc-spoke/aviatrix"
  version        = "1.6.6"
  cloud          = "OCI"
  account        = var.oci_account_name
  region         = var.oci_spoke1_region
  name           = var.oci_spoke1_name
  cidr           = var.oci_spoke1_cidr
  ha_gw          = var.spoke_ha_enabled
  network_domain = aviatrix_segmentation_network_domain.BU1.domain_name
  transit_gw     = module.oci_transit_1.transit_gateway.gw_name
}


OCI and GCP providers

# OCI
provider "oci" {
  tenancy_ocid = var.oci_tenancy_id
  user_ocid    = var.oci_user_id
  fingerprint  = var.oci_fingerprint
  private_key  = var.oci_private_key
  region       = var.oci_region
}

# GCP
provider "google" {
  project = var.account_name_in_gcp
  region  = "us-east1"
}

# OR
provider "google" {
  project = var.account_name_in_gcp
  region  = "us-east1"
  credentials = var.gcp_credentials
}

I use this procedure to setup GCP and OCI credentials key on Terraform Cloud:

  • Create an environment variable called GOOGLE_CREDENTIALS in Terraform Cloud workspace.
  • Remove the newline characters from JSON key file and then paste the credentials into the environment variable value field.
  • Mark the variable as Sensitive.

Note: Others ressource are well created on GCP and OCI, so for the classic setup terraform configuration is ok, so i need help about Aviatrix gcp_account, oci_accoint, oci_spoke, gcp_spoke, oci_transit, gcp_transit, using Terraform Cloud. 

 

Any idea ?

Best regards

icon

Best answer by MohammedBanabila 23 March 2024, 04:53

View original

2 replies

@Merlin S , Can you paste the errror that you see after creating the access account?

Userlevel 1
Badge +4

check    the resource  aviatrix_vpc   name  it repeated  

Reply