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: README.md
+39-13Lines changed: 39 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
This Terraform module creates a Workload Identity Pool and Provider for GitLab.
10
10
11
11
Service account keys are a security risk if compromised.
12
-
Avoid service account keys and instead use the [Workload Identity Federation](https://cloud.google.com/iam/docs/configuring-workload-identity-federation).
12
+
Avoid service account keys and instead use the [Workload Identity Federation](https://github.com/Cyclenerd/google-workload-identity-federation#readme).
13
13
For more information about Workload Identity Federation and how to best authenticate service accounts on Google Cloud, please see my GitHub repo [Cyclenerd/google-workload-identity-federation](https://github.com/Cyclenerd/google-workload-identity-federation#readme).
14
14
15
15
> There is also a ready-to-use Terraform module for [GitHub](https://github.com/Cyclenerd/terraform-google-wif-github#readme).
@@ -22,7 +22,7 @@ Create Workload Identity Pool and Provider:
22
22
# Create Workload Identity Pool Provider for GitLab
23
23
module "gitlab-wif" {
24
24
source = "Cyclenerd/wif-gitlab/google"
25
-
version = "1.0.0"
25
+
version = "~> 1.0.0"
26
26
project_id = "your-project-id"
27
27
}
28
28
@@ -47,7 +47,7 @@ data "google_service_account" "gitlab" {
47
47
# Allow service account to login via WIF and only from GitLab repository (project path)
> The attributes `attribute.sub` and `attribute.repository` are used in the Terrform module [Cyclenerd/wif-service-account/google](https://github.com/Cyclenerd/terraform-google-wif-service-account).
| `attribute.sub` | `assertion.sub` | Defines the subject claim (`project_path:{group}/{project}:ref_type:{type}:ref:{branch_name}`) that is to be validated by the cloud provider. This setting is essential for making sure that access tokens are only allocated in a predictable way.
73
+
| `attribute.repository` | `assertion.project_path` | The repository (project path) from where the workflow is running
74
+
| `attribute.aud` | `assertion.aud` | Intended audience for the token. Specified in the [ID tokens configuration](https://docs.gitlab.com/ee/ci/yaml/index.html#id_tokens). The domain of the GitLab instance by default.
75
+
| `attribute.iss` | `assertion.iss` | Issuer of the token, which is the domain of the GitLab instance.
76
+
| `attribute.namespace_id` | `assertion.namespace_id` | Use this to scope to group or user level namespace by ID.
77
+
| `attribute.namespace_path` | `assertion.namespace_path` | Use this to scope to group or user level namespace by path.
78
+
| `attribute.project_id` | `assertion.project_id` | Use this to scope to project by ID.
79
+
| `attribute.project_path` | `assertion.project_path` | Use this to scope to project by path.
80
+
| `attribute.user_id` | `assertion.user_id` | ID of the user executing the job.
81
+
| `attribute.user_login` | `assertion.user_login` | Username of the user executing the job.
82
+
| `attribute.user_email` | `assertion.user_email` | Email of the user executing the job.
83
+
| `attribute.pipeline_id` | `assertion.pipeline_id` | ID of the pipeline.
| `attribute.job_id` | `assertion.job_id` | ID of the job.
86
+
| `attribute.ref` | `assertion.ref` | Git ref for the job.
87
+
| `attribute.ref_type` | `assertion.ref_type` | Git ref type, either `branch` or `tag`.
88
+
| `attribute.ref_protected` | `assertion.ref_protected` | `true` if the Git ref is protected, `false` otherwise.
89
+
| `attribute.environment` | `assertion.environment` | Environment this job deploys to (introduced in GitLab 13.9).
90
+
| `attribute.environment_protected` | `assertion.environment_protected` | `true` if deployed environment is protected, `false` otherwise (introduced in GitLab 13.9).
91
+
| `attribute.deployment_tier` | `assertion.deployment_tier` | Deployment tier of the environment the job specifies. Introduced in GitLab 15.2.
92
+
| `attribute.runner_id` | `assertion.runner_id` | ID of the runner executing the job. Introduced in GitLab 16.0.
93
+
| `attribute.runner_environment` | `assertion.runner_environment` | The type of runner used by the job. Can be either `gitlab-hosted` or `self-hosted`. Introduced in GitLab 16.0.
94
+
| `attribute.sha` | `assertion.sha` | The commit SHA for the job. Introduced in GitLab 16.0.
| <aname="input_issuer_uri"></a> [issuer\_uri](#input\_issuer\_uri)| Workload Identity Pool Provider issuer URI |`string`|`"https://gitlab.com"`| no |
87
111
| <aname="input_pool_description"></a> [pool\_description](#input\_pool\_description)| Workload Identity Pool description |`string`|`"Workload Identity Pool for GitLab (Terraform managed)"`| no |
88
112
| <aname="input_pool_disabled"></a> [pool\_disabled](#input\_pool\_disabled)| Workload Identity Pool disabled |`bool`|`false`| no |
@@ -109,3 +133,5 @@ Attribute mapping:
109
133
## License
110
134
111
135
All files in this repository are under the [Apache License, Version 2.0](LICENSE) unless noted otherwise.
136
+
137
+
Based on [Terraform module for workload identity federation on GCP](https://github.com/mscribellito/terraform-google-workload-identity-federation) by [Michael S](https://github.com/mscribellito).
"attribute.job_id"="assertion.job_id"# ID of the job.
129
+
"attribute.ref"="assertion.ref"# Git ref for the job.
130
+
"attribute.ref_type"="assertion.ref_type"# Git ref type, either branch or tag.
131
+
"attribute.ref_protected"="assertion.ref_protected"# true if the Git ref is protected, false otherwise.
132
+
"attribute.environment"="assertion.environment"# Environment this job deploys to (introduced in GitLab 13.9).
133
+
"attribute.environment_protected"="assertion.environment_protected"# true if deployed environment is protected, false otherwise (introduced in GitLab 13.9).
134
+
"attribute.deployment_tier"="assertion.deployment_tier"# Deployment tier of the environment the job specifies. Introduced in GitLab 15.2.
135
+
"attribute.runner_id"="assertion.runner_id"# ID of the runner executing the job. Introduced in GitLab 16.0.
136
+
"attribute.runner_environment"="assertion.runner_environment"# The type of runner used by the job. Can be either gitlab-hosted or self-hosted. Introduced in GitLab 16.0.
137
+
"attribute.sha"="assertion.sha"# The commit SHA for the job. Introduced in GitLab 16.0.
138
+
}
139
+
}
140
+
141
+
variable"attribute_condition" {
142
+
type=string
143
+
description="(Optional) Workload Identity Pool Provider attribute condition expression"
0 commit comments