Skip to content

Commit 00c4e79

Browse files
authored
TF lint (#3)
* Update docs after removing unused vars Badges styling fix Add GitLab CI workflow reference example * Removed unused vars
1 parent 01d4948 commit 00c4e79

File tree

8 files changed

+13
-40
lines changed

8 files changed

+13
-40
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Terraform AWS GitLab OIDC Provider [![CI](https://github.com/saidsef/terraform-aws-gitlab-oidc/actions/workflows/ci.yaml/badge.svg)](#deployment) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE.md)
1+
# Terraform AWS GitLab OIDC Provider
2+
[![CI](https://github.com/saidsef/terraform-aws-gitlab-oidc/actions/workflows/ci.yaml/badge.svg)](#deployment--usage) ![GitHub issues](https://img.shields.io/github/issues-raw/saidsef/terraform-aws-gitlab-oidc) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE.md)
23

34
This Terraform module enables you to configure GitLab Actions as an AWS IAM OIDC identity provider in AWS, which enables GitLab Actions to access resources within an AWS account(s) without requiring long-lived credentials to be stored as GitLab secrets.
45

@@ -31,12 +32,16 @@ module "gitlab_oidc" {
3132

3233
Please see [TERRAFORM.md](./TERRAFORM.md)
3334

35+
## GitLab Runner
36+
37+
Retrieve temporary credentials via [GitLab Runner](https://github.com/saidsef/terraform-aws-gitlab-oidc/blob/2b26d4f844a0ed52b10c72100e744d38965ab748/.gitlab-ci.yml#L16-L28)
38+
3439
## Source
3540

36-
Our latest and greatest source of `terraform-aws-gitlab-oidc` can be found on [GitLab](#deployment). Fork us!
41+
Our latest and greatest source of `terraform-aws-gitlab-oidc` can be found on [GitHub](https://github.com/saidsef/terraform-aws-gitlab-oidc/). Fork us!
3742

3843
## Contributing
3944

4045
We would :heart: you to contribute by making a [pull request](https://github.com/saidsef/terraform-aws-gitlab-oidc/pulls).
4146

42-
Please read the official [Contribution Guide](./CONTRIBUTING.md) for more information on how you can contribute.
47+
Please read the official [Contribution Guide](./CONTRIBUTING.md) for more information on how you can contribute.

TERRAFORM.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
| Name | Version |
1212
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.0 |
14-
| <a name="provider_tls"></a> [tls](#provider\_tls) | ~> 4.0 |
13+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.38.0 |
14+
| <a name="provider_tls"></a> [tls](#provider\_tls) | 4.0.4 |
1515

1616
## Modules
1717

@@ -42,8 +42,6 @@ No modules.
4242
| <a name="input_force_detach_policies"></a> [force\_detach\_policies](#input\_force\_detach\_policies) | Force detachment of policies attached to the IAM role | `string` | `false` | no |
4343
| <a name="input_gitlab_organisation"></a> [gitlab\_organisation](#input\_gitlab\_organisation) | GitLab organisation name | `string` | n/a | yes |
4444
| <a name="input_gitlab_repositories"></a> [gitlab\_repositories](#input\_gitlab\_repositories) | List of GitLab repository name(s) and branche names or patterns | <pre>list(object({<br> name = string<br> branches = list(string)<br> }))</pre> | <pre>[<br> {<br> "branches": null,<br> "name": null<br> }<br>]</pre> | no |
45-
| <a name="input_iam_policy_name"></a> [iam\_policy\_name](#input\_iam\_policy\_name) | Name of the IAM policy to be assumed by GitLab. | `string` | `"gitlab"` | no |
46-
| <a name="input_iam_policy_path"></a> [iam\_policy\_path](#input\_iam\_policy\_path) | Path to the IAM policy | `string` | `"/"` | no |
4745
| <a name="input_iam_role_name"></a> [iam\_role\_name](#input\_iam\_role\_name) | Name of the IAM role | `string` | `"gitlab-runner"` | no |
4846
| <a name="input_iam_role_path"></a> [iam\_role\_path](#input\_iam\_role\_path) | Path to the IAM role | `string` | `"/"` | no |
4947
| <a name="input_iam_role_permissions_boundary"></a> [iam\_role\_permissions\_boundary](#input\_iam\_role\_permissions\_boundary) | ARN of the permissions boundary to be used by the IAM role | `string` | `""` | no |

exmaples/complete/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ No resources.
2727
| <a name="input_force_detach_policies"></a> [force\_detach\_policies](#input\_force\_detach\_policies) | Force detachment of policies attached to the IAM role | `string` | `false` | no |
2828
| <a name="input_gitlab_organisation"></a> [gitlab\_organisation](#input\_gitlab\_organisation) | GitLab organisation name | `string` | `"saidsef"` | no |
2929
| <a name="input_gitlab_repositories"></a> [gitlab\_repositories](#input\_gitlab\_repositories) | List of GitLab repository name(s) and branche names or patterns | <pre>list(object({<br> name = string<br> branches = list(string)<br> }))</pre> | <pre>[<br> {<br> "branches": null,<br> "name": null<br> }<br>]</pre> | no |
30-
| <a name="input_iam_policy_name"></a> [iam\_policy\_name](#input\_iam\_policy\_name) | Name of the IAM policy to be assumed by GitLab. | `string` | `"gitlab"` | no |
31-
| <a name="input_iam_policy_path"></a> [iam\_policy\_path](#input\_iam\_policy\_path) | Path to the IAM policy | `string` | `"/"` | no |
3230
| <a name="input_iam_role_name"></a> [iam\_role\_name](#input\_iam\_role\_name) | Name of the IAM role | `string` | `"gitlab-runner"` | no |
3331
| <a name="input_iam_role_path"></a> [iam\_role\_path](#input\_iam\_role\_path) | Path to the IAM role | `string` | `"/"` | no |
3432
| <a name="input_iam_role_permissions_boundary"></a> [iam\_role\_permissions\_boundary](#input\_iam\_role\_permissions\_boundary) | ARN of the permissions boundary to be used by the IAM role | `string` | `""` | no |

exmaples/complete/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ module "gitlab_oidc" {
1212
force_detach_policies = false
1313
gitlab_organisation = var.gitlab_organisation
1414
gitlab_repositories = [{ name = "terraform-aws-gitlab-oidc", branches = ["main", "pr-*", "*pull*", "*"] }]
15-
iam_policy_name = "gitlab"
16-
iam_policy_path = "/"
1715
iam_role_name = "gitlab-runner"
1816
iam_role_path = "/"
1917
iam_role_permissions_boundary = ""

exmaples/complete/terraform.tfvars

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ gitlab_repositories = [
1010
"name" : null
1111
}
1212
]
13-
iam_policy_name = "gitlab"
14-
iam_policy_path = "/"
1513
iam_role_name = "gitlab-runner"
1614
iam_role_path = "/"
1715
iam_role_permissions_boundary = ""

exmaples/complete/variables.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ variable "gitlab_repositories" {
5252
description = "List of GitLab repository name(s) and branche names or patterns"
5353
}
5454

55-
variable "iam_policy_name" {
56-
default = "gitlab"
57-
description = "Name of the IAM policy to be assumed by GitLab."
58-
type = string
59-
}
60-
61-
variable "iam_policy_path" {
62-
default = "/"
63-
description = "Path to the IAM policy"
64-
type = string
65-
}
66-
6755
variable "iam_role_name" {
6856
default = "gitlab-runner"
6957
description = "Name of the IAM role"

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ resource "aws_iam_role" "role" {
1616
}
1717

1818
resource "aws_iam_role_policy_attachment" "admin" {
19-
count = tobool(var.enabled) && var.attach_admin_policy ? 1 : 0
19+
count = tobool(var.enabled) && tobool(var.attach_admin_policy) ? 1 : 0
2020

2121
policy_arn = format("arn:%s:iam::aws:policy/AdministratorAccess", data.aws_partition.current.partition)
2222
role = aws_iam_role.role[0].id
2323
}
2424

2525
resource "aws_iam_role_policy_attachment" "read_only" {
26-
count = tobool(var.enabled) && var.attach_read_only_policy ? 1 : 0
26+
count = tobool(var.enabled) && tobool(var.attach_read_only_policy) ? 1 : 0
2727

2828
policy_arn = format("arn:%s:iam::aws:policy/ReadOnlyAccess", data.aws_partition.current.partition)
2929
role = aws_iam_role.role[0].id
@@ -37,7 +37,7 @@ resource "aws_iam_role_policy_attachment" "custom" {
3737
}
3838

3939
resource "aws_iam_openid_connect_provider" "provider" {
40-
count = tobool(var.enabled) && var.create_oidc_provider ? 1 : 0
40+
count = tobool(var.enabled) && tobool(var.create_oidc_provider) ? 1 : 0
4141
client_id_list = [format("https://%s", var.url)]
4242

4343
tags = var.tags

variables.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ variable "gitlab_repositories" {
4545
description = "List of GitLab repository name(s) and branche names or patterns"
4646
}
4747

48-
variable "iam_policy_name" {
49-
default = "gitlab"
50-
description = "Name of the IAM policy to be assumed by GitLab."
51-
type = string
52-
}
53-
54-
variable "iam_policy_path" {
55-
default = "/"
56-
description = "Path to the IAM policy"
57-
type = string
58-
}
59-
6048
variable "iam_role_name" {
6149
default = "gitlab-runner"
6250
description = "Name of the IAM role"

0 commit comments

Comments
 (0)