Deploying resources in a specific region or across multiple regions
IBM Cloud® Schematics enables you to deploy resources in any IBM Cloud location or region globally. The region where you save and execute your Schematics workspaces
and actions
is independent of the region where your
IBM Cloud resources are deployed or configured.
IBM Cloud Schematics executes your jobs from your selected Schematics region and remotely access the services to provision resources in the target regions determined by your Terraform templates. It is unaffected by network latency between regions.
For example, If you create a workspace in us-south
, you can use this workspace to provision services in any supported IBM Cloud region, such as us-east
or eu-gb
. The location of your workspace determines
where your workspace data is stored and where your workspace requests are run. For more information, see Where is the information stored?
Deploying services in a specific region
If all your services can be deployed to the same region, you can specify the region in the provider
block of your Terraform template.
If no region is specified in the provider
block, Schematics automatically attempts to create your IBM Cloud resources in the us-south
region.
-
Open the
provider.tf
file or the Terraform configuration file that contains theprovider
block. -
Specify the region where you want to deploy your services. Make sure that the region that you enter is supported by the service that you want to deploy with Schematics.
provider "ibm" { region = "<region_name>" }
-
Check if the service that you want to deploy requires a
location
parameter to be set in addition to theregion
parameter. For example, if you use theibm_database
Terraform resource, you must set both theregion
parameter in theprovider
block and thelocation
parameter in theibm_database
resource definition. -
Follow the steps to deploy your IBM Cloud resources.
Deploying services across regions
You can add multiple multiple provider configurations to the provider
block to specify the regions where you want to deploy your IBM Cloud resources. For more information, see Multiple Provider Instances.
-
In the
provider
block of your Terraform configuration file or theprovider.tf
file, create multiple provider blocks with the same provider name. The provider configuration without an alias is considered the default provider configuration and is used for every resource where you do not specify a specific provider configuration. If you add more provider configurations, you must include an alias so that you can reference this provider from your resource definition in the Terraform configuration file. In the following example, the default provider configuration deploys resources inus-south
while the provider configuration with the aliaseast
deploys all resources inus-east
.provider "ibm" { region = "us-south" } provider "ibm" { alias = "east" region = "us-east" }
-
In your resource definition of your Terraform configuration file, specify the provider configuration that you want to use. If you do not specify a provider, the default provider configuration is used.
resource "ibm_container_cluster" "cluster" { provider = ibm.east ... } resource ibm_is_vpc "vpc" { name = "myvpc" }
-
Follow the steps to deploy your IBM Cloud resources.