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
+48-18Lines changed: 48 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,31 @@
1
1
# AWS GitLab OIDC Provider Terraform Module
2
2
3
-
This module allows you to create a GitHub OIDC provider and the associated IAM roles, that will help Github Actions to securely authenticate against the AWS API using an IAM role.
3
+
This module allows you to create an AWS IAM OIDC provider that trusts GitLab and the associated IAM roles, that will help GitLab Pipelines to securely authenticate against the AWS API using an IAM role.
4
4
5
-
We recommend using GitHub's OIDC provider to get short-lived credentials needed for your actions. Specifying role-to-assume without providing an aws-access-key-id or a web-identity-token-file will signal to the action that you wish to use the OIDC provider. The default session duration is 1 hour when using the OIDC provider to directly assume an IAM Role. The default session duration is 6 hours when using an IAM User to assume an IAM Role (by providing an aws-access-key-id, aws-secret-access-key, and a role-to-assume) . If you would like to adjust this you can pass a duration to role-duration-seconds, but the duration cannot exceed the maximum that was defined when the IAM Role was created. The default session name is GitHubActions, and you can modify it by specifying the desired name in role-session-name.
5
+
We recommend using GitLab's OIDC issuer to get short-lived credentials needed for your pipelines. Specifying role-to-assume without providing an aws-access-key-id or a web-identity-token-file will signal to the pipeline that you wish to use the OIDC provider. The default session duration is 1 hour when using the OIDC provider to directly assume an IAM Role. The default session duration is 6 hours when using an IAM User to assume an IAM Role (by providing an aws-access-key-id, aws-secret-access-key, and a role-to-assume) . If you would like to adjust this you can pass a duration to role-duration-seconds, but the duration cannot exceed the maximum that was defined when the IAM Role was created. The default session name is `GitLabRunner-${CI_PROJECT_ID}-${CI_PIPELINE_ID}`, and you can modify it by specifying the desired name in role-session-name.
6
6
7
7
## Use-Cases
8
8
9
9
1. Retrieve temporary credentials from AWS to access cloud services
10
10
1. Use credentials to retrieve secrets or deploy to an environment
11
11
1. Scope role to branch or project
12
-
1. Create an AWS OIDC provider for GitHub Actions
12
+
1. Create an AWS OIDC provider for GitLab Pipelines
13
13
14
14
## Features
15
15
16
-
2. Create one or more IAM role that can be assumed by GitHub Actions
16
+
2. Create one or more IAM role that can be assumed by GitLab Pipelines
| Create a role for all repositories in a specific Github organisation| ✅ |
25
-
| Create a role specific to a repository for a specific organisation| ✅ |
26
-
| Create a role specific to a branch in a repository| ✅ |
27
-
| Create a role for multiple organisations/repositories/branches | ✅ |
28
-
| Create a role for organisations/repositories/branches selected by wildcard (e.g. `feature/*` branches) | ✅ |
24
+
| Create a role for all projects in a specific GitLab namespace | ✅ |
25
+
| Create a role specific to a project for a specific namespace | ✅ |
26
+
| Create a role specific to a branch in a project | ✅ |
27
+
| Create a role for multiple namespaces/projects/branches| ✅ |
28
+
| Create a role for namesapces/projectss/branches selected by wildcard (e.g. `feature/*` branches)| ✅ |
29
29
30
30
---
31
31
@@ -57,14 +57,14 @@ We recommend using GitHub's OIDC provider to get short-lived credentials needed
57
57
IMPORTANT: The master branch is used in source just as an example. In your code, do not pin to master because there may be breaking changes between releases. Instead pin to the release tag (e.g. ?ref=tags/x.y.z) of one of our [latest releases](https://github.com/terraform-module/terraform-aws-gitlab-oidc-provider/releases).
@@ -81,35 +81,65 @@ See `examples` directory for working examples to reference
81
81
## Available features
82
82
83
83
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
84
+
# AWS Gitlab OIDC Provider Terraform Module
85
+
86
+
## Purpose
87
+
This module allows you to create a Gitlab OIDC provider for your AWS account, that will allow Gitlab pipelines to securely authenticate against the AWS API using an IAM role
| <aname="input_variable"></a> [variable](#input\_variable)| defaul,description,type |`string`|`"variable"`| no |
122
+
| <aname="input_aud_value"></a> [aud\_value](#input\_aud\_value)| (Required) A list of client IDs (also known as audiences). When a mobile or web app registers with an OpenID Connect provider, they establish a value that identifies the application. (This is the value that's sent as the client\_id parameter on OAuth requests.) |`list(string)`| <pre>[<br> "https://gitlab.com"<br>]</pre> | no |
123
+
| <aname="input_create_oidc_provider"></a> [create\_oidc\_provider](#input\_create\_oidc\_provider)| Whether or not to create the associated oidc provider. If false, variable 'oidc\_provider\_arn' is required |`bool`|`true`| no |
124
+
| <aname="input_create_oidc_role"></a> [create\_oidc\_role](#input\_create\_oidc\_role)| Whether or not to create the OIDC attached role |`bool`|`true`| no |
125
+
| <aname="input_gitlab_tls_url"></a> [gitlab\_tls\_url](#input\_gitlab\_tls\_url)| the Hashicorp TLS provider has started following redirects starting v4. so we use tls:// |`string`|`"tls://gitlab.com:443"`| no |
126
+
| <aname="input_match_field"></a> [match\_field](#input\_match\_field)| the token field the OIDC provider filter on |`string`|`"sub"`| no |
127
+
| <aname="input_max_session_duration"></a> [max\_session\_duration](#input\_max\_session\_duration)| Maximum session duration in seconds. |`number`|`3600`| no |
128
+
| <aname="input_oidc_role_attach_policies"></a> [oidc\_role\_attach\_policies](#input\_oidc\_role\_attach\_policies)| Attach policies to OIDC role. |`list(string)`|`[]`| no |
129
+
| <aname="input_projects"></a> [projects](#input\_projects)| List of GitLab namesapce/project names authorized to assume the role. |`list(string)`|`[]`| no |
130
+
| <aname="input_role_description"></a> [role\_description](#input\_role\_description)| (Optional) Description of the role. |`string`|`"Role assumed by the Gitlab OIDC provider."`| no |
131
+
| <aname="input_role_name"></a> [role\_name](#input\_role\_name)| (Optional, Forces new resource) Friendly name of the role. |`string`|`"gitlab-oidc-provider-aws"`| no |
132
+
| <aname="input_tags"></a> [tags](#input\_tags)| A mapping of tags to assign to all resources |`map(string)`|`{}`| no |
133
+
| <aname="input_url"></a> [url](#input\_url)| GitLab OpenID TLS certificate URL. The address of your GitLab instance, such as https://gitlab.com or http://gitlab.example.com.|`string`|`"https://gitlab.com"`| no |
107
134
108
135
## Outputs
109
136
110
137
| Name | Description |
111
138
|------|-------------|
112
-
| <aname="output_used"></a> [used](#output\_used)| used value |
Copy file name to clipboardExpand all lines: main.tf
+11-10Lines changed: 11 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,10 @@
2
2
* # AWS Gitlab OIDC Provider Terraform Module
3
3
*
4
4
* ## Purpose
5
-
* This module allows you to create a Gitlab OIDC provider for your AWS account, that will help Gitlab Actions to securely authenticate against the AWS API using an IAM role
5
+
* This module allows you to create a Gitlab OIDC provider for your AWS account, that will allow Gitlab pipelines to securely authenticate against the AWS API using an IAM role
description="the token field the OIDC provider filter on"
72
+
type=string
73
+
default="sub"
78
74
}
79
75
80
76
variable"gitlab_tls_url" {
81
-
type=string
82
-
# Avoid using https scheme because the Hashicorp TLS provider has started following redirects starting v4.
77
+
type=string
78
+
description="the Hashicorp TLS provider has started following redirects starting v4. so we use tls://"
83
79
# See https://github.com/hashicorp/terraform-provider-tls/issues/249
84
80
default="tls://gitlab.com:443"
85
81
}
86
82
87
83
variable"aud_value" {
88
84
description="(Required) A list of client IDs (also known as audiences). When a mobile or web app registers with an OpenID Connect provider, they establish a value that identifies the application. (This is the value that's sent as the client_id parameter on OAuth requests.)"
0 commit comments