Skip to content

dbtutor/tfocilab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform OCI Workshop with Terraform Cloud

Please make sure you have added the following environment variables in Terraform Cloud Variables sections

  • Tenancy OCID tenancy_ocid
  • User OCID user_ocid
  • Fingerprint fingerprint by using cat ~/.oci/config
  • Private Key private_key - Please be sure add only private_key no path and enter the contents of private keys by cat ~/.oci/oci_api_key_public.pem
  • Region short code region
  • Compartment OCID - compartment_ocid Note tenancy_ocid will be equals to root compartment_ocid
  • ssh_public_key ssh_public_key
  • ssh_private_key ssh_private_key

Sample - How to get them

  • private_key_path - cat ~/.oci/oci_api_key.pem
  • ssh_public_key - cat ~/.ssh/id_rsa.pub
  • ssh_private_key - cat ~/.ssh/id_rsa
  • Public key value in PEM format cat ~/.oci/oci_api_key_public.pem
  • verify the fingerprint cat ~/.oci/config

image

Following are the examples of using variables

variables.tf

variable "tenancy_ocid" {}
variable "user_ocid" {}
variable "fingerprint" {}
# Use private_key not private_key_path
variable "private_key" {}
variable "region" {}
variable "compartment_ocid" {}
variable "ssh_public_key" {}
variable "ssh_private_key" {}

provider.tf

provider "oci" {
  tenancy_ocid         = var.tenancy_ocid
  user_ocid            = var.user_ocid
  fingerprint          = var.fingerprint
  # Use private_key not private_key_path
  private_key          = var.private_key
  region               = var.region
}

Troubleshooting

If you the the following error, then please make sure variables has been provided provided properly -

Error: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401. Opc request id: f3d755f51620785d4abe8a74015845e8/E0B7936CA17E70456C50A90A29417FCC/7E8A1852E77727701DBCE49767C65EB7

About

Terraform OCI Workshop with Terraform Cloud

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages