Learn how to deploy the Terraform authentication template in Oracle Cloud Infrastructure.
When you have downloaded the Terraform template file in the onboarding wizard, you must connect to Oracle Cloud Infrastructure (OCI) CLI tool to deploy the template file. For more information about the OCI CLI tool, refer Oracle documentation. to create a stack using the template file.
Prerequisite
Before you begin, ensure you have:
An Oracle Cloud Infrastructure account and the tenancy OCID.
Permission to deploy a custom template and create its resources in OCI.
Installed Terraform on your local machine. You can download Terraform from the official Terraform website and follow the installation instructions for your operating system.
Installed the OCI CLI tool, and authenticated with a key pair or token-based credentials.
Reviewed the introduction to Terraform for Cloud service provider (CSP) onboarding to understand the underlying logic of how Terraform interacts with your cloud environment.
Log in to OCI and open Cloud Shell.
Create a directory on your local machine to store and run the Terraform code. If you have more than one OCI connector, you need a separate directory for each one. For example:
mkdir -p ~/terraform/oci-connector-1
Navigate to the directory you created and extract the Terraform files. Ensure all necessary Terraform files are present (
main.tf,template_params.tfvars, and so on). For example:cd ~/terraform/oci-connector-1 tar -xzvf <your_template>.tar.gz.
Initialize Terraform in your project directory:
terraform init
It might take several seconds until the initialization is complete.
Apply your Terraform configuration using the downloaded parameter file. When prompted to enter a value, enter the tenancy OCID.
terraform apply --var-file=template_params.tfvars
When prompted, review the actions the Terraform will perform, and approve them by entering
yes.The Terraform template is deployed.
When the template is successfully uploaded to GCP, the initial discovery scan is started. When the scan is complete, you can view your cloud assets in Asset Inventory.