Invoke Terraform Scripts
Use specific commands to invoke the Terraform scripts in Oracle WebLogic Server for OCI.
Note:
You can download a previous version of the terraform script from: https://releases.hashicorp.com/terraform/Invoke terraform scripts in an infrastructure
- Go to the directory where you unpacked the Terraform Configuration File (.zip) file using Download a Terraform Configuration File.
- In this directory, create a terraform file:
terraform.tfvars
- In the
terraform.tfvars
file, add the variables that are referenced in theprovider.tf
file.These are the variables that you noted in the
provider.tf
file in Download a Terraform Configuration File.For a sample of
terraform.tfvars
file, see Sample Scripts. - Run the following command to initialize the terraform provider plugin:
$ terraform init
- Add in the variables required for the desired topology to the
terraform.tfvars
file.For the list of variables, see Variables in Terraform Scripts and Sample Scripts.
- Run the following command to invoke apply:
$ terraform apply
- Optional: Run the following command to create multiple instances from same solutions:
$ terraform apply -state=<file_name>
Where, <file_name> is the unique directory name or state file name for each stack.
Update an infrastructure:
- Go to the directory where you unpacked the Terraform Configuration File (.zip) file using Download a Terraform Configuration File.
- In this directory, create a terraform file:
terraform.tfvars
- In the
terraform.tfvars
file, add the variables that are referenced in theprovider.tf
file.These are the variables that you noted in the
provider.tf
file in Download a Terraform Configuration File.For a sample of
terraform.tfvars
file, see Sample Scripts. - Update the variables required for the desired topology to the
terraform.tfvars
file. For the list of variables you can update, see Table 1-1. - Run the following command to invoke apply:
$ terraform apply
Destroy an infrastructure
$ terraform destroy
Tip:
You can invoke terraform scripts by using the Resource Manager. See Get Started with Oracle WebLogic Server for Oracle Cloud Infrastructure and Managing Stacks and Jobs.