IT infrastructure is moving to the cloud. Using an automation tool, such as Terraform, to manage this infrastructure is the norm today, but what if you didn’t start using Terraform from the beginning? This is the reality for many of our customers.
To build out their initial infrastructure, customers often use the Oracle Cloud Infrastructure Console or an SDK. As the infrastructure increases in scale and complexity, it becomes evident that it would be better managed programmatically, but it’s not always easy to bring existing infrastructure under Terraform. You’re often left with two options: discard the deployed infrastructure and re-create these resources using Terraform, or write in-house scripts to individually import resources into Terraform.
In a similar scenario, most managed service providers develop their own custom methods for managing their customers’ cloud. Having successfully completed this task, they want to replicate this infrastructure architecture for other customers. If the service provider hasn’t used Terraform from the beginning, this replication process is tedious.
We want to make this migration process less painful.
Oracle Cloud Infrastructure has two tools to help you manage your infrastructure programmatically: Terraform Provider and Resource Manager (our managed Terraform-as-a-service solution). Today we’re announcing two new features to help you bring your existing infrastructure to Terraform and Resource Manager:
You can use Terraform Resource Discovery to discover deployed resources in your compartment and export them to Terraform configuration and state files. This release supports the most commonly used Oracle Cloud Infrastructure services, such as Compute, Block Volumes, Networking, Load Balancing, Database, and Identity and Access Management (IAM). We’re continuously adding support for other Oracle Cloud services.
With this feature, you can perform the following tasks:
To start using this feature, download the latest version of the terraform-oci-provider package by using the terraform init command or by going to the Terraform releases page. This feature is available for terraform-oci-provider 3.50 and later. To learn how to use this feature, see Discovering Terraform resources in an Oracle Cloud Infrastructure compartment.
State File Import lets you migrate your existing Terraform state files to Resource Manager. After you migrate, you can use Resource Manager to manage your entire fleet.
To use Terraform features that aren’t supported by Resource Manager, follow these steps:
Note: When migrating Terraform to Resource Manager, perform only step 3.
In Resource Manager, download the current state file from its Job Details page.
Upload the new state file (and any updated configuration settings) to the Resource Manager stack by selecting the new Import State command from the Terraform Actions menu.
If you’re new to Resource Manager or our Terraform Provider service, use the following resources to get started.