Configure the Terraform Modules

All the compute, networking, and storage infrastructure resources necessary for this solution are defined in Terraform modules.

Before You Begin

Before you start configuring the Terraform modules, complete the following steps:

  1. Learn the basics of Terraform.

    At a minimum, read the introduction in the Terrraform documentation.

  2. Keep the following information ready:
    • The OCID of your tenancy.

      You can find your tenancy's OCID in the Oracle Cloud Infrastructure web console. Select Administration from the services menu, and then click Tenancy Details.

    • The OCID of the user that you want Terraform to use to authenticate with Oracle Cloud Infrastructure.

      To find the user's OCID, select Identity from the services menu, and then select Users. Locate your user name in the list, and copy its OCID.

    • The OCID of the compartment in which you want to create the resources.

      To find a compartment's OCID, select Identity from the services menu, and then select Compartments. Locate the compartment that you need in the list, and copy its OCID.

    • The ID of region where you want to create the resources.

      For example, the ID of the US East (Ashburn) region is us-ashburn-1.

      See Regions and Availability Domains.

  3. Decide the following:
  4. Verify that the service limits of your tenancy can accommodate all the resources that you want to create.

Download the Terraform Code

The Terraform code for this solution is available on GitHub.

  1. In the navigation pane on the left, click Download Code.
  2. Click Git Repo.
  3. Clone or download the repository to your local computer.

About the Terraform Code

The Terraform code that you downloaded has the following structure:

├── oci-hyperion-master
│   ├── _docs
│   ├── *.tf
│   ├── env-vars
│   ├── LICENSE.md
│   ├── modules
│   │   ├── bastion
│   │   ├── compute
│   │   ├── dbsystem
│   │   ├── filesystem
│   │   ├── loadbalancer
│   │   └── network
│   ├── orm
│   ├── README.md
│   ├── schema.yaml
│   ├── terraform.tfvars
│   ├── userdata
  • _docs directory: Contains the architecture diagrams.
  • *.tf: The Terraform configuration files that the solution uses. Do not edit these files.
  • env-vars: A script to set the environment variables for Terraform.
  • LICENSE.md: The license terms for the code.
  • modules: Directories containing the core Terraform configurations for the resources that you create by using this solution. Do not edit them.
  • orm: Contains a zip file that you can use to create a stack in Oracle Cloud Infrastructure Resource Manager, instead of using Terraform to deploy the solution.
  • README.md: Quick-start documentation for the code.
  • schema.yaml: The constraints and validations for the variables used in the Terraform code. This file is used when you deploy the resources using Oracle Resource Manager. Do not edit this file.
  • terraform.tfvars: The Terraform variables. You'll set values for the variables in this file later.
  • userdata: Contains a script that runs on the compute instances after they're created. Do not edit the files in this directory.

Set the Terraform Environment Variables

The Terraform code includes a script file that you can use to store values for certain Terraform parameters as environment variables.

  1. Make sure that you've completed the prerequisites described earlier.
  2. On your local computer, go to the directory where you downloaded the Terraform code.
  3. In the top-level directory of the code, locate and open the file env-vars in a plain-text editor.
  4. Enter appropriate values for the variables in the file.

    Note:

    As you specify the value for each variable, remember to uncomment the line; that is remove the # (hash) character at the start of the line.
  5. Verify the values you specified.
    If you omit any values, you’ll be prompted for input when you run Terraform. If you provide incorrect values, Terraform will error out.
  6. When you’re satisfied that all the values are correct, save and close the file.
  7. Set the environment variables by running the following command from the directory that contains the environment variables file, by running the following command:
    source ./env-vars
  8. Verify that you've set all the environment variables, by running the following command:
    env | grep TF
    The environment variables that you set are displayed.

Set the Deployment Parameters

Specify the compute, networking, database, and storage resources to be created and their properties.

  1. Make sure that you've completed the prerequisites described earlier.
  2. In the top-level directory of the code that you downloaded or cloned, locate the terraform.tfvars file, and open it in a plain-text editor.
  3. Set values for the variables listed in terraform.tfvars.
    The README file in the code that you downloaded contains descriptions for the variables, and it includes a sample of a completed terraform.tfvars file.
  4. Save and close terraform.tfvars.