You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -59,22 +59,32 @@ Six test-kitchen instances are defined:
59
59
The test-kitchen instances in `test/fixtures/` wrap identically-named examples in the `examples/` directory.`
60
60
61
61
### Test Environment
62
-
The easiest way to test the module is in an isolated test project. The setup for such a project is defined in [test/setup](./test/setup/) directory.
62
+
The easiest way to test the module is in an isolated test project. The
63
+
setup for such a project is defined in [test/setup](./test/setup/)
64
+
directory.
63
65
64
-
To use this setup, you need a service account with Project Creator access on a folder. Export the Service Account credentials to your environment like so:
66
+
To use this setup, you need a service account with Project Creator access
67
+
on a folder; the Billing Account User role is also required. Export the
68
+
Service Account credentials to your environment like so:
65
69
66
70
```
67
71
export SERVICE_ACCOUNT_JSON=$(< credentials.json)
68
72
```
69
73
74
+
Note that `SERVICE_ACCOUNT_JSON` holds the _contents_ of the credentials
75
+
file; if you see errors pertaining to credential type, ensure this variable
76
+
contains valid JSON, and not, for example, a path.
77
+
70
78
You will also need to set a few environment variables:
name = google_service_account.preexisting.account_id
61
+
project_id = var.project_id
62
+
}
63
+
```
64
+
46
65
### Using an existing Kubernetes Service Account
47
66
48
-
An existing kubernetes service account can optionally be used. When using an existing k8s servicea account the annotation `"iam.gke.io/gcp-service-account"` must be set.
67
+
An existing Kubernetes service account can optionally be used.
| annotate\_k8s\_sa | Annotate the kubernetes service account with 'iam.gke.io/gcp-service-account' annotation. Valid in cases when an existing SA is used. |`bool`|`true`| no |
73
95
| automount\_service\_account\_token | Enable automatic mounting of the service account token |`bool`|`false`| no |
74
96
| cluster\_name | Cluster name. Required if using existing KSA. |`string`|`""`| no |
97
+
| gcp\_sa\_name | Name for the Google service account; overrides `var.name`. |`string`|`null`| no |
75
98
| impersonate\_service\_account | An optional service account to impersonate for gcloud commands. If this service account is not specified, the module will use Application Default Credentials. |`string`|`""`| no |
76
-
| k8s\_sa\_name | Name for the existing Kubernetes service account |`string`|`null`| no |
99
+
| k8s\_sa\_name | Name for the Kubernetes service account; overrides `var.name`.|`string`|`null`| no |
77
100
| location | Cluster location (region if regional cluster, zone if zonal cluster). Required if using existing KSA. |`string`|`""`| no |
78
101
| name | Name for both service accounts. The GCP SA will be truncated to the first 30 chars if necessary. |`string`| n/a | yes |
79
-
| namespace | Namespace for k8s service account |`string`|`"default"`| no |
102
+
| namespace | Namespace for the Kubernetes service account |`string`|`"default"`| no |
Copy file name to clipboardExpand all lines: modules/workload-identity/variables.tf
+25-13Lines changed: 25 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,23 @@ variable "name" {
19
19
type=string
20
20
}
21
21
22
+
variable"project_id" {
23
+
description="GCP project ID"
24
+
type=string
25
+
}
26
+
27
+
variable"gcp_sa_name" {
28
+
description="Name for the Google service account; overrides `var.name`."
29
+
type=string
30
+
default=null
31
+
}
32
+
33
+
variable"use_existing_gcp_sa" {
34
+
description="Use an existing Google service account instead of creating one"
35
+
type=bool
36
+
default=false
37
+
}
38
+
22
39
variable"cluster_name" {
23
40
description="Cluster name. Required if using existing KSA."
24
41
type=string
@@ -32,48 +49,43 @@ variable "location" {
32
49
}
33
50
34
51
variable"k8s_sa_name" {
35
-
description="Name for the existing Kubernetes service account"
52
+
description="Name for the Kubernetes service account; overrides `var.name`."
36
53
type=string
37
54
default=null
38
55
}
39
56
40
57
variable"namespace" {
41
-
description="Namespace for k8s service account"
42
-
default="default"
43
-
type=string
44
-
}
45
-
46
-
variable"project_id" {
47
-
description="GCP project ID"
58
+
description="Namespace for the Kubernetes service account"
48
59
type=string
60
+
default="default"
49
61
}
50
62
51
63
variable"use_existing_k8s_sa" {
52
64
description="Use an existing kubernetes service account instead of creating one"
53
-
default=false
54
65
type=bool
66
+
default=false
55
67
}
56
68
57
69
variable"annotate_k8s_sa" {
58
70
description="Annotate the kubernetes service account with 'iam.gke.io/gcp-service-account' annotation. Valid in cases when an existing SA is used."
59
-
default=true
60
71
type=bool
72
+
default=true
61
73
}
62
74
63
75
variable"automount_service_account_token" {
64
76
description="Enable automatic mounting of the service account token"
65
-
default=false
66
77
type=bool
78
+
default=false
67
79
}
68
80
69
81
variable"roles" {
82
+
description="A list of roles to be added to the created service account"
70
83
type=list(string)
71
84
default=[]
72
-
description="(optional) A list of roles to be added to the created Service account"
73
85
}
74
86
75
87
variable"impersonate_service_account" {
76
-
type=string
77
88
description="An optional service account to impersonate for gcloud commands. If this service account is not specified, the module will use Application Default Credentials."
0 commit comments