Invoke Terraform Scripts

Use specific commands to invoke the terraform scripts in Oracle WebLogic Server for OKE.

The following section reference files in the input directory that you need create. Depending on the type of stack (JRF or non-JRF), create the appropriate files in the inputs directory. For information about the input files, see Sample Scripts.

To invoke terraform scripts in an infrastructure:

Complete the following steps:
  1. Go to the directory, where you unzipped the terraform configuration files.
  2. Initialize the terraform provider plugin:
    $ terraform init
  3. Initialize the environment with terraform environment var files:
    $ source inputs/env_vars
  4. Invoke apply passing all *.tfvars files as input:

    Tip:

    If you do not specify the -var-file, then the defaults in vars.tf will apply.
    • WebLogic Non-JRF:
      $ terraform apply -var-file=inputs/instance.tfvars
    • WebLogic JRF with OCI database:
      $ terraform apply -var-file=inputs/instance.tfvars -var-file=inputs/oci_db.tfvars
    • WebLogic JRF with ATP database:
      $ terraform apply -var-file=inputs/instance.tfvars -var-file=inputs/atp_db.tfvars
  5. Create multiple instances from same solutions:
    $ terraform apply -var-file=inputs/instance.tfvars -state=<file_name>

    Where, <file_name> is the unique directory name or state file name for each stack.

To update an infrastructure:

Complete the following steps:
  1. Update the variables. For the list of variables you can update, see Table 1-1.
  2. Complete step 1 through step 4 in Invoke terraform scripts.

To destroy an infrastructure:

$ terraform destroy -var-file=inputs/instance.tfvars

Delete the Resources and Stack

Tip:

You can invoke terraform scripts by using the Resource Manager. See Get Started with Oracle WebLogic Server for OKE and Managing Stacks and Jobs.