Skip to content

Commit 1763dac

Browse files
authored
fix: Provide empty fallback value for user_id local (#588)
* Provide empty fallback value for user_id local Signed-off-by: Devon Crouse <[email protected]> * Update quickstart for provider.tf.example Signed-off-by: Devon Crouse <[email protected]> Signed-off-by: Devon Crouse <[email protected]>
1 parent c67a0a1 commit 1763dac

File tree

2 files changed

+5
-39
lines changed

2 files changed

+5
-39
lines changed

docs/quickstart.adoc

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
:uri-oci-okepolicy: https://docs.cloud.oracle.com/iaas/Content/ContEng/Concepts/contengpolicyconfig.htm#PolicyPrerequisitesService
1616
:uri-oci-provider: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
1717
:uri-oci-provider-precedence: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm#terraformproviderconfiguration_topic-Order_of_Precedence
18+
:uri-provider-example: {uri-rel-file-base}/provider.tf.example
1819
:uri-terraform: https://www.terraform.io
1920
:uri-terraform-oci: https://www.terraform.io/docs/providers/oci/index.html
2021
:uri-terraform-options: {uri-docs}/terraformoptions.adoc
@@ -52,46 +53,11 @@ You need to create 2 providers:
5253
.. 1 provider for the region where your OKE cluster and other resources will be created
5354
.. 1 provider for the home region. This is required for conducting identity operations. *Note that your home region may not necessarily be the same as your current region.*
5455

55-
. Create a provider.tf file in root add 2 providers:
56-
+
57-
----
58-
provider "oci" {
59-
fingerprint = var.api_fingerprint
60-
private_key_path = var.api_private_key_path
61-
region = var.region
62-
tenancy_ocid = var.tenancy_id
63-
user_ocid = var.user_id
64-
}
65-
66-
provider "oci" {
67-
fingerprint = var.api_fingerprint
68-
private_key_path = var.api_private_key_path
69-
region = var.home_region
70-
tenancy_ocid = var.tenancy_id
71-
user_ocid = var.user_id
72-
alias = "home"
73-
}
74-
----
75-
76-
. Alternatively, you can also specify the key directly:
56+
. Create a provider.tf file in root with 2 providers. An {uri-provider-example}[example] is provided for convenience:
7757
+
58+
[source,bash]
7859
----
79-
provider "oci" {
80-
fingerprint = var.api_fingerprint
81-
private_key = var.api_private_key
82-
region = var.regions["oke"]
83-
tenancy_ocid = var.tenancy_id
84-
user_ocid = var.user_id
85-
}
86-
87-
provider "oci" {
88-
fingerprint = var.api_fingerprint
89-
private_key = var.api_private_key
90-
region = var.regions["home"]
91-
tenancy_ocid = var.tenancy_id
92-
user_ocid = var.user_id
93-
alias = "home"
94-
}
60+
cp provider.tf.example provider.tf
9561
----
9662

9763
. You can also create use providers ({uri-oci-provider}[using differerent methods]) such as:

locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ locals {
77
var.compartment_id, var.compartment_ocid,
88
var.tenancy_id, var.tenancy_ocid,
99
)
10-
user_id = coalesce(var.user_id, var.current_user_ocid)
10+
user_id = var.user_id != "" ? var.user_id : var.current_user_ocid
1111

1212
api_private_key = (
1313
var.api_private_key != ""

0 commit comments

Comments
 (0)