Migrate Terraform Scripts v1.1.x to v1.5.x
You can access the Terraform Scripts of an Oracle WebLogic Server for OCI and modify them as needed. See Terraform Scripts in Oracle WebLogic Server for OCI.
This appendix describes the steps required to upgrade your existing WLS for OCI ORM stack from Terraform version v1.1.x to v1.5.x.
- Prerequisites
 - Step 1: Download the Terraform configuration file and state
 - Step 2: Upgrade the configuration
 - Step 3: Upgrade the stack
 - Step 4: Import the state file
 - Step 5: Validate the stack for any issues
 - References
 
Pre-requisites
To successfully upgrade your stack, you must have the following requirements:
- 
                     
                     
A MacOS, Linux, or Windows computer for running command line tools
 - 
                     
                     Software to create and unpack
archives, such as 7-ZIP.zip 
Step 1: Download the Terraform configuration file and state.
- 
                     
                     
On a computer that can run command line tools, create a folder to store the downloaded Terraform configuration and state.
Example folder name:/Users/<GUID>/Downloads/stack_terraform_config/ - From the Console: On the Stacks list page, select the stack that you want to work with. If you need help finding the list page or the stack, see Listing Stacks.
 - Next to Terraform configuration, select Download.
                     
For CLI and API instructions, see Getting a Stack's Terraform Configuration.
 - Download the Terraform state file:
                     
- On the stack's details page, select View state.
 - To download the stack's state file, go to More actions and select Download Terraform state.
 
 
For CLI and API instructions, see Getting a Stack's State File.
When the Terraform configuration and state are downloaded, you can proceed to the next task for upgrading the Terraform configuration.
Step 2: Upgrade the configuration.
- Extract the downloaded Terraform 
configuration zip. - Replace the information in the original 
versions.tffile with the content listed below. The dependent modules will also be upgraded.# Copyright (c) 2023, 2025, Oracle and/or its affiliates. # Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. terraform { required_version ="~> 1.5.7" required_providers { oci = { source = "oracle/oci" version = "~> 7.17.0" } random = { version = "~> 3.7.2" } template = { version = "~> 2.2.0" } tls = { version = "~> 4.1.0" } time = { version = "~> 0.13.1" } null = { version = "~> 3.2.4" } } } - Update the unzipped 
<terraform config>/modules/lb/loadbalancer/outputs.tffile, as it contains a depreciated attribute "ip_addresses":- Open the 
<unzipped terraform config>/modules/lb/loadbalancer/outputs.tffile. - Locate this string in the
                        file:
oci_load_balancer_load_balancer.wls_loadbalancer.ip_addresses - Replace the string
                        with:
oci_load_balancer_load_balancer.wls_loadbalancer.ip_address_details[*].ip_address 
 - Open the 
 - Create a 
.ziparchive of your Terraform configuration files. This zip file will contain the upgraded Terraform configuration to Terraform 1.5.x.The Terraform configuration is successfully upgraded to Terraform 1.5.x
 
Step 3: Upgrade the stack
- In the Console, reopen the details page for the stack that you're upgrading: On the Stacks list page, select the stack that you want to work with. If you need help finding the list page or the stack, see Listing Stacks.
 - 
                     
                     
From the Edit dropdown menu for the stack, select Edit Stack.
 - Upload the upgraded Terraform
                    configuration to the stack.
                     
You can either drag the file onto the dialog's control or select Browse and navigate to the location of the file or folder.
 - 
                     
                     Change the Terraform version to 1.5.x. Click Yes to confirm the change.
Figure D-1 Terraform target version

 - 
                     
                     
- Select Next. This will bring you to the Configure variables panel.
 - Review the options selected to make sure that they correspond
                        to the options you want the Stack to have.
                           
Note:
There is a known issue where the "Use Resource Manager Endpoint" may be selected even if you deselected this option during Stack creation. Unselect this option before proceeding. - Select Next. This will bring you to the Review panel.
 - Review the variables, paying particular attention to the "Terraform version" value which should now be 1.5.x.
 - Select Save Changes.
 
Figure D-2 Save changes

Figure D-3 Save and exit

 
The stack is now synchronized with the upgraded Terraform configuration and specified Terraform version. You can now proceed to the next task for importing the state file.
Step 4: Import the state file
- In the Console, reopen the details page for the stack that you're upgrading: On the Stacks list page, select the stack that you want to work with. If you need help finding the list page or the stack, see Listing Stacks.
 - 
                     
                     Go to More actions and select Import state.
Figure D-4 Import state file

 - In the Import panel, add the downloaded Terraform state file
                from Step 1-4. 
                     You can either drag the file onto the dialog's control or select Browse and navigate to the location of the file or folder.
Figure D-5 Import state file

 - Select Show advanced options.
 - Select the checkbox for "Upgrade provider versions" and select
                    Import.
                     
The import job is created. The new job is listed under Jobs. When the job finishes, the Job details page opens.
 - 
                     
                     Confirm successful import: Select Logs.
Figure D-6 Confirm import

 
After a successful import of the state file, proceed to the next task for checking for issues.
Step 5: Validate the stack for any issues
- On the Stacks list page, select the stack that you want to work with. If you need help finding the list page or the stack, see Listing Stacks.
 - Check for pending changes to infrastructure:
                     
- 
                           
                           Select Plan.
Figure D-7 Validate import

When the action finishes, the details page for the related job opens.
 - 
                           
                           
To review the log for the completed plan action, select Logs.
 - 
                           
                           
In the log contents, check for issues described at Troubleshooting Logs During an Upgrade.
 
 - 
                           
                           
 - Resolve any listed issues by manually updating the Terraform configuration, as described at Troubleshooting Logs During an Upgrade.
 
References
For more information, see Upgrading a Stack to a Later Terraform Version.