Skip to content

Commit 858e08d

Browse files
committed
docs: Capture before/after in upgrade guide from testing
1 parent a43eb37 commit 858e08d

File tree

8 files changed

+633
-51
lines changed

8 files changed

+633
-51
lines changed

docs/UPGRADE-6.0.md

Lines changed: 589 additions & 41 deletions
Large diffs are not rendered by default.

examples/iam-role/main.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,26 @@ module "iam_role_github_oidc" {
140140
tags = local.tags
141141
}
142142

143+
################################################################################
144+
# IAM Role - CircleCI OIDC
145+
################################################################################
146+
147+
module "iam_role_github_oidc" {
148+
source = "../../modules/iam-role"
149+
150+
name = local.name
151+
152+
enable_oidc = true
153+
oidc_provider_urls = ["oidc.circleci.com/org/<CIRCLECI_ORG_UUID>"]
154+
oidc_audiences = ["<CIRCLECI_ORG_UUID>"]
155+
156+
policies = {
157+
AmazonEC2ContainerRegistryPowerUser = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser"
158+
}
159+
160+
tags = local.tags
161+
}
162+
143163
################################################################################
144164
# IAM Role - SAML 2.0
145165
################################################################################

modules/iam-group/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resource "aws_iam_group_membership" "this" {
3939
################################################################################
4040

4141
locals {
42-
create_policy = var.create && var.create_policy && (var.enable_self_management_permissions || length(var.permission_statements) > 0)
42+
create_policy = var.create && var.create_policy && (var.enable_self_management_permissions || var.permission_statements != null)
4343

4444
policy_name = try(coalesce(var.policy_name, var.name), "")
4545
}
@@ -174,7 +174,8 @@ data "aws_iam_policy_document" "this" {
174174
for_each = var.enable_self_management_permissions && var.enable_mfa_enforcment ? [1] : []
175175

176176
content {
177-
sid = "DenyAllExceptListedIfNoMFA"
177+
sid = "DenyAllExceptListedIfNoMFA"
178+
effect = "Deny"
178179
not_actions = [
179180
"iam:CreateVirtualMFADevice",
180181
"iam:EnableMFADevice",

modules/iam-group/migrations.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
################################################################################
2+
# Migrations: v5.60 -> v6.0
3+
################################################################################
4+
5+
moved {
6+
from = aws_iam_policy.iam_self_management
7+
to = aws_iam_policy.this
8+
}
9+
10+
moved {
11+
from = aws_iam_group_policy_attachment.iam_self_management
12+
to = aws_iam_group_policy_attachment.this
13+
}

modules/iam-role-for-service-accounts/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ resource "aws_iam_role_policy_attachment" "this" {
169169
################################################################################
170170

171171
locals {
172-
create_iam_role_inline_policy = var.create && length(var.inline_policy_statements) > 0
172+
create_iam_role_inline_policy = var.create && var.inline_policy_statements
173173
}
174174

175175
data "aws_iam_policy_document" "inline" {

modules/iam-role/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ No modules.
166166
| <a name="input_max_session_duration"></a> [max\_session\_duration](#input\_max\_session\_duration) | Maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours | `number` | `null` | no |
167167
| <a name="input_name"></a> [name](#input\_name) | Name to use on IAM role created | `string` | `null` | no |
168168
| <a name="input_oidc_account_id"></a> [oidc\_account\_id](#input\_oidc\_account\_id) | An overriding AWS account ID where the OIDC provider lives; leave empty to use the current account ID for the AWS provider | `string` | `null` | no |
169-
| <a name="input_oidc_audiences"></a> [oidc\_audiences](#input\_oidc\_audiences) | The audience to be added to the role policy. Set to sts.amazonaws.com for cross-account assumable role. Leave empty otherwise. | `set(string)` | `[]` | no |
169+
| <a name="input_oidc_audiences"></a> [oidc\_audiences](#input\_oidc\_audiences) | The audience to be added to the role policy. Set to sts.amazonaws.com for cross-account assumable role. Leave empty otherwise. | `list(string)` | `[]` | no |
170170
| <a name="input_oidc_provider_urls"></a> [oidc\_provider\_urls](#input\_oidc\_provider\_urls) | List of URLs of the OIDC Providers | `list(string)` | `[]` | no |
171-
| <a name="input_oidc_subjects"></a> [oidc\_subjects](#input\_oidc\_subjects) | The fully qualified OIDC subjects to be added to the role policy | `set(string)` | `[]` | no |
172-
| <a name="input_oidc_wildcard_subjects"></a> [oidc\_wildcard\_subjects](#input\_oidc\_wildcard\_subjects) | The OIDC subject using wildcards to be added to the role policy | `set(string)` | `[]` | no |
171+
| <a name="input_oidc_subjects"></a> [oidc\_subjects](#input\_oidc\_subjects) | The fully qualified OIDC subjects to be added to the role policy | `list(string)` | `[]` | no |
172+
| <a name="input_oidc_wildcard_subjects"></a> [oidc\_wildcard\_subjects](#input\_oidc\_wildcard\_subjects) | The OIDC subject using wildcards to be added to the role policy | `list(string)` | `[]` | no |
173173
| <a name="input_path"></a> [path](#input\_path) | Path of IAM role | `string` | `"/"` | no |
174174
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | ARN of the policy that is used to set the permissions boundary for the IAM role | `string` | `null` | no |
175175
| <a name="input_policies"></a> [policies](#input\_policies) | Policies to attach to the IAM role in `{'static_name' = 'policy_arn'}` format | `map(string)` | `{}` | no |

modules/iam-role/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ resource "aws_iam_role_policy_attachment" "this" {
306306
################################################################################
307307

308308
locals {
309-
create_iam_role_inline_policy = var.create && length(var.inline_policy_statements) > 0
309+
create_iam_role_inline_policy = var.create && var.inline_policy_statements != null
310310
}
311311

312312
data "aws_iam_policy_document" "inline" {

modules/iam-role/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,19 @@ variable "oidc_provider_urls" {
112112

113113
variable "oidc_subjects" {
114114
description = "The fully qualified OIDC subjects to be added to the role policy"
115-
type = set(string)
115+
type = list(string)
116116
default = []
117117
}
118118

119119
variable "oidc_wildcard_subjects" {
120120
description = "The OIDC subject using wildcards to be added to the role policy"
121-
type = set(string)
121+
type = list(string)
122122
default = []
123123
}
124124

125125
variable "oidc_audiences" {
126126
description = "The audience to be added to the role policy. Set to sts.amazonaws.com for cross-account assumable role. Leave empty otherwise."
127-
type = set(string)
127+
type = list(string)
128128
default = []
129129
}
130130

0 commit comments

Comments
 (0)