@@ -10,7 +10,20 @@ gcloud auth login
10
10
> NOTE: If you don't have Google Cloud CLI, check out
11
11
[ installation guide] ( https://cloud.google.com/sdk/install )
12
12
13
- ## Get Values from Your Google Cloud Account
13
+ ## Setup Environment Variables (Will Be Used Later)
14
+
15
+ Manual Setup (set values in double quotes and run the following command in terminal):
16
+ ``` shell
17
+ export GOOGLE_CLOUD_PROJECT=" " # # e.g. terrahub-123456
18
+ export GOOGLE_APPLICATION_CREDENTIALS=" " # # e.g. ${HOME}/.config/gcloud/terraform.json
19
+ export ORG_ID=" " # # e.g. 123456789012
20
+ export BILLING_ID=" " # # e.g. 123456-ABCDEF-ZYXWVU
21
+ export PROJECT_NAME=" " # # e.g. TerraHub
22
+ export IAM_NAME=" " # # e.g. terraform
23
+ export IAM_DESC=" " # # e.g. terraform service account
24
+ ```
25
+
26
+ ### Setup ORG_ID Programmatically
14
27
15
28
Run the following command in terminal:
16
29
``` shell
@@ -23,6 +36,16 @@ DISPLAY_NAME ID DIRECTORY_CUSTOMER_ID
23
36
mydomain.com 123456789012 a1b2c3d4e
24
37
```
25
38
39
+ Automated Setup (run the following command in terminal):
40
+ ``` shell
41
+ export ORG_ID=" $( gcloud organizations list --format=json | jq ' .[0].name[14:]' ) "
42
+ ```
43
+
44
+ > NOTE: If you don't have JQ CLI, check out
45
+ [ installation guide] ( https://stedolan.github.io/jq/download/ )
46
+
47
+ ### Setup BILLING_ID Programmatically
48
+
26
49
Run the following command in terminal:
27
50
``` shell
28
51
gcloud beta billing accounts list
@@ -34,22 +57,8 @@ ACCOUNT_ID NAME OPEN MASTER_ACCOUNT_ID
34
57
123456-ABCDEF-ZYXWVU My Billing Account True
35
58
```
36
59
37
- ## Setup Environment Variables (Will Be Used Later)
38
-
39
- Manual Setup (set values in double quotes and run the following command in terminal):
40
- ``` shell
41
- export GOOGLE_CLOUD_PROJECT=" " # # e.g. terrahub-123456
42
- export GOOGLE_APPLICATION_CREDENTIALS=" " # # e.g. ${HOME}/.config/gcloud/terraform.json
43
- export ORG_ID=" " # # e.g. 123456789012
44
- export BILLING_ID=" " # # e.g. 123456-ABCDEF-ZYXWVU
45
- export PROJECT_NAME=" " # # e.g. TerraHub
46
- export IAM_NAME=" " # # e.g. terraform
47
- export IAM_DESC=" " # # e.g. terraform service account
48
- ```
49
-
50
60
Automated Setup (run the following command in terminal):
51
61
``` shell
52
- export ORG_ID=" $( gcloud organizations list --format=json | jq ' .[0].name[14:]' ) "
53
62
export BILLING_ID=" $( gcloud beta billing accounts list --format=json | jq ' .[0].name[16:]' ) "
54
63
```
55
64
0 commit comments