-
Notifications
You must be signed in to change notification settings - Fork 0
/
providers.tf
43 lines (38 loc) · 1.45 KB
/
providers.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
terraform {
required_version = ">= 1.0.0"
required_providers {
oci = {
source = "oracle/oci"
version = "4.70.0"
}
}
}
# -----------------------------------------------------------------------------
# Support for multi-region deployments
# -----------------------------------------------------------------------------
data "oci_identity_region_subscriptions" "regions" {
tenancy_id = var.tenancy_ocid
}
locals {
region_subscriptions = data.oci_identity_region_subscriptions.regions.region_subscriptions
home_region = [for region in local.region_subscriptions : region.region_name if region.is_home_region == true]
region_key = [for region in local.region_subscriptions : region.region_key if region.region_name == var.region]
}
# -----------------------------------------------------------------------------
# Provider blocks for home region and alternate region(s)
# -----------------------------------------------------------------------------
provider "oci" {
tenancy_ocid = var.tenancy_ocid
user_ocid = var.current_user_ocid
fingerprint = var.api_fingerprint
private_key_path = var.api_private_key_path
region = var.region
}
provider "oci" {
alias = "home_region"
tenancy_ocid = var.tenancy_ocid
user_ocid = var.current_user_ocid
fingerprint = var.api_fingerprint
private_key_path = var.api_private_key_path
region = local.home_region[0]
}