Plan the Deployment

Deploying Terraform in a multicloud environment uses the following basic steps.

  1. Establish an external connection

    When you deploy a staging, development, QA or production environment across multiple cloud regions, you first need to establish an external connection from Oracle Cloud Infrastructure Resource Manager to a source code control system such as GitHub, GitLab, or Bitbucket. GitHub contains the Terraform modules that you want to deploy across compartments in an Oracle Cloud Infrastructure region.

    The following diagram shows this relationship:



    iac-multi-account-deployment-oracle.zip

  2. Change code

    The central code repository in GitHub contains the Terraform modules checked in by the Development Operations (DevOps) team. This team of engineers works within the infrastructure repository in a short-lived, v1.0, branch. Once the code changes in the short-lived branch are ready, the DevOps engineer reviews and merges them into the main branch. The DevOps engineer then provides Git tags for the repository. For any future changes in the infrastructure repository, the DevOps engineer repeats this same process.

    The deployment is triggered from the DevOps engineer who tags the repository that contains the Terraform code. This action starts the deployment pipeline execution.

    Tagging the repository with dev-us-ashburn-1/dev/1.0 triggers the pipeline to deploy the compute development account to the US-Ashburn-1 region.

    The example tag dev-us-ashburn-1/dev/1.0, contains the target environment (Dev), the Oracle Region (US-Ashburn-1), the team (Dev), and a version number (1.0). You can manage other target deployments such as QA, staging, and production in a similar way.



    iac-multi-region-deployment-oracle.zip

  3. Deploy the development environment

    To deploy the development environment across us-ashburn-1, us-phoenix-1 and us-sanjose-1 regions in a multicloud deployment, verify the VCN in which you want to deploy the infrastructure. Separate code pipelines are checked into the GitHub repository as shown above. Changes, such as adding or removing resources, are made to the pipeline and a new version of the Git tag is created and then pushed into the region to deploy resources.

  4. Create a configuration source provider

    In Oracle Cloud Infrastructure Resource Manager, the first step is to create a configuration source provider with a public endpoint to the GitHub server where the terraform modules are deployed. Each region has its own source provider and then the resources are deployed in the compartment in which you want to deploy the resources: development, QA, staging, or production. Use the Oracle Cloud Infrastructure command line interface (CLI) as needed after the code approval stage is completed to create a stack. Execute the Terraform plan after you create the stack. After the plan is successfully executed, the Terraform is applied. Following the execution, check for the resources that are created in the corresponding compartments and regions. Terraform state files are stored and maintained in Oracle Cloud Infrastructure Registry. Metadata such as YAML files are stored in Oracle Cloud Infrastructure Artifacts Registry. You can also enable Oracle Cloud Infrastructure Notifications and Oracle Cloud Infrastructure Events to alert and notify you of the progress of provisioning the infrastructure deployment.