Skip to content

Commit c492346

Browse files
authored
removed identity parameters and locally initialized home region provider in favour of passed home region provider (#44)
1 parent 3f2a71c commit c492346

File tree

7 files changed

+18
-79
lines changed

7 files changed

+18
-79
lines changed

datasources.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ data "oci_identity_tenancy" "tenancy" {
1919
tenancy_id = var.tenancy_id
2020
}
2121

22-
# get the tenancy's home region
23-
data "oci_identity_regions" "home_region" {
24-
filter {
25-
name = "key"
26-
values = [data.oci_identity_tenancy.tenancy.home_region_key]
27-
}
28-
}
29-
3022
data "oci_core_vcn" "vcn" {
3123
vcn_id = var.vcn_id
3224
}

docs/quickstart.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,22 @@ provider "oci" {
5959
private_key_path = var.api_private_key_path
6060
region = var.region
6161
}
62+
provider "oci" {
63+
tenancy_ocid = var.tenancy_id
64+
user_ocid = var.user_id
65+
fingerprint = var.api_fingerprint
66+
private_key_path = var.api_private_key_path
67+
region = var.home_region
68+
alias = "home"
69+
}
6270
----
6371

6472
. Set mandatory provider parameters:
6573

6674
* `api_fingerprint`
6775
* `api_private_key_path`
6876
* `region`
77+
* `home_region`
6978
* `tenancy_id`
7079
* `user_id`
7180

docs/terraformoptions.adoc

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,11 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
2929
|Values
3030
|Default
3131

32-
|`api_fingerprint`
33-
|ssl fingerprint of api public key. *Required when configuring provider*.
34-
|
35-
|None
36-
37-
|`api_private_key_path`
38-
|path to api private key. *Required when configuring provider*.
39-
|
40-
|None
41-
42-
|`region`
43-
|Region where to provision the OKE cluster. {uri-oci-region}[List of regions]. *Required when configuring provider*.
44-
|
45-
|None
46-
4732
|`tenancy_id`
4833
|Tenancy id of the user. *Required when configuring provider*.
4934
|
5035
|None
5136

52-
|`user_id`
53-
|User's id. *Required when configuring provider*.
54-
|
55-
|None
56-
5737
|===
5838

5939
== General OCI
@@ -163,8 +143,8 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
163143
|true/false
164144
|true
165145

166-
|`operating_system_version`
167-
|The version of the Oracle Linux to use..
146+
|`operator_os_version`
147+
|The version of the Oracle Linux to use.
168148
|
169149
|8
170150

@@ -225,13 +205,13 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
225205
|Values
226206
|Default
227207

228-
|`tags`
208+
|`operator_tags`
229209
|Freeform tags for operator.
230210
|
231211
|
232212
[source]
233213
----
234-
tags = {
214+
operator_tags = {
235215
access = "restricted"
236216
environment = "dev"
237217
role = "operator"

instance_principal.tf

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
# Copyright 2017, 2021 Oracle Corporation and/or affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

4-
# create a home region provider for identity operations
5-
provider "oci" {
6-
alias = "home"
7-
fingerprint = var.api_fingerprint
8-
private_key_path = var.api_private_key_path
9-
region = lookup(data.oci_identity_regions.home_region.regions[0], "name")
10-
tenancy_ocid = var.tenancy_id
11-
user_ocid = var.user_id
12-
}
13-
144
resource "oci_identity_dynamic_group" "operator_instance_principal" {
155
provider = oci.home
166

177
compartment_id = var.tenancy_id
18-
description = var.label_prefix == "none" ? "dynamic group to allow instances to call services for 1 operator" : "dynamic group with label ${var.label_prefix} to allow instances to call services for 1 operator"
8+
description = var.label_prefix == "none" ? "dynamic group to allow operator instance to invoke services" : "dynamic group with label ${var.label_prefix} to allow operator to invoke services"
199

2010
lifecycle {
2111
ignore_changes = [name, defined_tags]

terraform.tfvars.example

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,14 @@
33

44
# provider identity parameters
55

6-
api_fingerprint = ""
7-
8-
api_private_key_path = ""
9-
10-
region = ""
11-
126
tenancy_id = ""
137

14-
user_id = ""
15-
168
# general oci parameters
17-
189
compartment_id = ""
1910

2011
label_prefix = "dev"
2112

2213
# network parameters
23-
2414
availability_domain = 1
2515

2616
nat_route_id = ""
@@ -33,6 +23,7 @@ nsg_ids = []
3323

3424
vcn_id = ""
3525

26+
# operator host parameters
3627
operating_system_version = "8"
3728

3829
create_operator = true
@@ -69,7 +60,7 @@ operator_notification_protocol = "EMAIL"
6960

7061
operator_notification_topic = "operator"
7162

72-
tags = {
63+
operator_tags = {
7364
access = "restricted"
7465
environment = "dev"
7566
role = "operator"

variables.tf

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,13 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
33

44
# provider parameters
5-
variable "api_fingerprint" {
6-
description = "fingerprint of oci api private key"
7-
type = string
8-
default = ""
9-
}
10-
11-
variable "api_private_key_path" {
12-
description = "path to oci api private key used"
13-
type = string
14-
default = ""
15-
}
16-
17-
variable "region" {
18-
# List of regions: https://docs.cloud.oracle.com/iaas/Content/General/Concepts/regions.htm#ServiceAvailabilityAcrossRegions
19-
description = "the oci region where resources will be created"
20-
type = string
21-
}
225

236
variable "tenancy_id" {
247
description = "tenancy id where to create the sources"
258
type = string
269
default = ""
2710
}
2811

29-
variable "user_id" {
30-
description = "id of user that terraform will use to create the resources"
31-
type = string
32-
default = ""
33-
}
34-
3512
# general oci parameters
3613

3714
variable "compartment_id" {
@@ -146,9 +123,7 @@ variable "upgrade_operator" {
146123
type = bool
147124
}
148125

149-
150126
# operator notification
151-
152127
variable "enable_operator_notification" {
153128
description = "Whether to enable ONS notification for the operator host."
154129
default = false

versions.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ terraform {
55
required_providers {
66
oci = {
77
source = "hashicorp/oci"
8+
# pass oci home region provider explicitly for identity operations
9+
configuration_aliases = [ oci.home ]
810
}
911
}
1012
required_version = ">= 1.0.0"

0 commit comments

Comments
 (0)