Skip to content

Commit 29a447d

Browse files
authored
chore!: Rename default IAM role to GitHubActions (#77)
1 parent 03185e5 commit 29a447d

File tree

5 files changed

+45
-40
lines changed

5 files changed

+45
-40
lines changed

examples/complete/main.tf

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1+
// SPDX-FileCopyrightText: 2024 Daniel Morris <[email protected]>
2+
// SPDX-License-Identifier: MIT
3+
14
provider "aws" {
2-
region = var.region
5+
default_tags {}
36
}
47

58
module "aws_oidc_github" {
69
source = "../../"
710

8-
enabled = var.enabled
9-
10-
additional_audiences = var.additional_audiences
11-
additional_thumbprints = var.additional_thumbprints
12-
attach_admin_policy = var.attach_admin_policy
13-
attach_read_only_policy = var.attach_read_only_policy
14-
create_oidc_provider = var.create_oidc_provider
15-
enterprise_slug = var.enterprise_slug
16-
force_detach_policies = var.force_detach_policies
17-
iam_role_name = var.iam_role_name
18-
iam_role_path = var.iam_role_path
19-
iam_role_permissions_boundary = var.iam_role_permissions_boundary
20-
iam_role_policy_arns = var.iam_role_policy_arns
21-
github_repositories = var.github_repositories
22-
max_session_duration = var.max_session_duration
23-
tags = var.tags
11+
additional_audiences = var.additional_audiences
12+
additional_thumbprints = var.additional_thumbprints
13+
attach_read_only_policy = var.attach_read_only_policy
14+
create_oidc_provider = var.create_oidc_provider
15+
dangerously_attach_admin_policy = var.dangerously_attach_admin_policy
16+
enterprise_slug = var.enterprise_slug
17+
force_detach_policies = var.force_detach_policies
18+
iam_role_name = var.iam_role_name
19+
iam_role_path = var.iam_role_path
20+
iam_role_permissions_boundary = var.iam_role_permissions_boundary
21+
iam_role_policy_arns = var.iam_role_policy_arns
22+
github_repositories = var.github_repositories
23+
max_session_duration = var.max_session_duration
24+
tags = var.tags
2425

2526
iam_role_inline_policies = {
2627
"example_inline_policy" : data.aws_iam_policy_document.example.json

examples/complete/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// SPDX-FileCopyrightText: 2024 Daniel Morris <[email protected]>
2+
// SPDX-License-Identifier: MIT
3+
14
output "iam_role_arn" {
25
description = "ARN of the IAM role."
36
value = module.aws_oidc_github.iam_role_arn

examples/complete/variables.tf

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// SPDX-FileCopyrightText: 2024 Daniel Morris <[email protected]>
2+
// SPDX-License-Identifier: MIT
3+
14
variable "additional_audiences" {
25
default = null
36
description = "List of additional OIDC audiences allowed to assume the role."
@@ -15,14 +18,8 @@ variable "additional_thumbprints" {
1518
}
1619
}
1720

18-
variable "attach_admin_policy" {
19-
default = false
20-
description = "Flag to enable/disable the attachment of the AdministratorAccess policy."
21-
type = bool
22-
}
23-
2421
variable "attach_read_only_policy" {
25-
default = true
22+
default = false
2623
description = "Flag to enable/disable the attachment of the ReadOnly policy."
2724
type = bool
2825
}
@@ -33,9 +30,9 @@ variable "create_oidc_provider" {
3330
type = bool
3431
}
3532

36-
variable "enabled" {
37-
default = true
38-
description = "Flag to enable/disable the creation of resources."
33+
variable "dangerously_attach_admin_policy" {
34+
default = false
35+
description = "Flag to enable/disable the attachment of the AdministratorAccess policy."
3936
type = bool
4037
}
4138

@@ -60,15 +57,15 @@ variable "github_repositories" {
6057
// organization/repository format used by GitHub.
6158
condition = length([
6259
for repo in var.github_repositories : 1
63-
if length(regexall("^[A-Za-z0-9_.-]+?/([A-Za-z0-9_.:/-]+[*]?|\\*)$", repo)) > 0
60+
if length(regexall("^[A-Za-z0-9_.-]+?/([A-Za-z0-9_.:/\\-\\*]+)$", repo)) > 0
6461
]) == length(var.github_repositories)
6562
error_message = "Repositories must be specified in the organization/repository format."
6663
}
6764
}
6865

6966
variable "iam_role_name" {
70-
default = "github"
71-
description = "Name of the IAM role to be created. This will be assumable by GitHub."
67+
default = "GitHubActions"
68+
description = "The name of the IAM role to be created and made assumable by GitHub Actions."
7269
type = string
7370
}
7471

@@ -90,6 +87,12 @@ variable "iam_role_policy_arns" {
9087
type = list(string)
9188
}
9289

90+
variable "iam_role_inline_policies" {
91+
default = {}
92+
description = "Inline policies map with policy name as key and json as value."
93+
type = map(string)
94+
}
95+
9396
variable "max_session_duration" {
9497
default = 3600
9598
description = "Maximum session duration in seconds."
@@ -101,11 +104,6 @@ variable "max_session_duration" {
101104
}
102105
}
103106

104-
variable "region" {
105-
description = "AWS region in which to apply resources."
106-
type = string
107-
}
108-
109107
variable "tags" {
110108
default = {}
111109
description = "Map of tags to be applied to all resources."

examples/complete/versions.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
// SPDX-FileCopyrightText: 2024 Daniel Morris <[email protected]>
2+
// SPDX-License-Identifier: MIT
3+
14
terraform {
25
required_providers {
36
aws = {
47
source = "hashicorp/aws"
5-
version = ">= 4.0"
8+
version = ">= 5.0"
69
}
710

811
tls = {
912
source = "hashicorp/tls"
10-
version = ">= 3.0"
13+
version = ">= 4.0"
1114
}
1215
}
1316

14-
required_version = "~> 1.0"
17+
required_version = "~> 1.10"
1518
}

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ variable "github_repositories" {
6464
}
6565

6666
variable "iam_role_name" {
67-
default = "github"
68-
description = "Name of the IAM role to be created. This will be assumable by GitHub."
67+
default = "GitHubActions"
68+
description = "The name of the IAM role to be created and made assumable by GitHub Actions."
6969
type = string
7070
}
7171

0 commit comments

Comments
 (0)