About Configuring Terraform on UNIX-Like Systems
To use Terraform to create Oracle Cloud Infrastructure components, you must download and install Terraform. You’ll also download the Terraform modules that create the configuration files that you’ll use create the required infrastructure components.
The system where you install Terraform and store the Teraform modules can be either on premises or in the cloud. For convenience, we’ll refer to this as your local system or your local host.
Before you run Terraform:
-
Generate an SSH key pair used to allow you to access your Compute instances
-
Generate an API signing key used to authenticate API calls made by Terraform
-
Set environment variables used by Terraform to authenticate access and execute its plans
After completing these steps, you’re ready to apply the Terraform configuration files to create your infrastructure components on Oracle Cloud Infrastructure.
Install Terraform
On UNIX-like or Linux systems, including Oracle Linux, you can install Terraform by downloading and extracting the Terraform package for your operating system.
Generate an SSH Key Pair to Access the Bastion Hosts
You can use SSH to access compute instances in Oracle Cloud securely. Generate an SSH key pair on your local host. Add the SSH public key to the bastion hosts while creating them. When you connect to a bastion host using SSH, provide the private key to authenticate access.
Use the ssh-keygen
utility to generate an SSH key pair. Don’t set a passphrase for your SSH key.
Make a note of the location.
Generate an SSH Key Pair to Access Private Instances
You can use bastion hosts to create SSH connections to compute instances that don’t have public IP addresses and don’t allow access over the public internet. As a security best practice, generate separate SSH key pairs for the bastion hosts and the private instances.
Use ssh-keygen
on your local host to generate an SSH key pair.
Make a note of the location where you save the SSH keys.
Generate an API Signing Key
You must provide an RSA key pair in the privacy-enhanced mail (PEM) format to enable Terraform to authenticate with Oracle Cloud
Infrastructure. Note that this API signing key is not the same as the SSH key pair that you use to access your instances. You can use OpenSSL
to generate the API signing key.
Make a note of the location.
Upload the API Signing Key Using the Console
After you generate an API signing key, you must upload the public key for the associated user in Oracle Cloud Infrastructure. The first time you upload an API signing key, you must use the web console. Subsequently, you can also use the API to upload an API key.