Skip to content

Commit

Permalink
feat: add jwt_condition option to oidc variable for IAM trust relatio…
Browse files Browse the repository at this point in the history
…nships (#608)
  • Loading branch information
hspitzley-czi authored Jul 24, 2024
1 parent b9ec4ec commit 5320504
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion aws-assume-role-policy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ data "aws_iam_policy_document" "assume-role" {
actions = ["sts:AssumeRoleWithWebIdentity", "sts:TagSession"]
condition {
test = "StringEquals"
variable = "${oidc.value["provider"]}:aud"
variable = "${oidc.value["provider"]}:${oidc.value["jwt_condition"]}"
values = oidc.value["client_ids"]
}
}
Expand Down
7 changes: 4 additions & 3 deletions aws-assume-role-policy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ variable "saml_idp_arns" {
variable "oidc" {
type = list(object(
{
idp_arn : string, # the AWS IAM IDP arn
client_ids : list(string), # a list of oidc client ids
provider : string # your provider url, such as foo.okta.com
idp_arn : string, # the AWS IAM IDP arn
client_ids : list(string), # a list of oidc client ids
provider : string, # your provider url, such as foo.okta.com
jwt_condition: optional(string, "aud") # the condition to allow the JWT token
}
))
default = []
Expand Down
3 changes: 3 additions & 0 deletions aws-assume-role-policy/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform {
required_version = ">= 1.3.0"
}
7 changes: 4 additions & 3 deletions aws-iam-role-crossacct/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ variable "source_role_arns" {
variable "oidc" {
type = list(object(
{
idp_arn : string, # the AWS IAM IDP arn
client_ids : list(string), # a list of oidc client ids
provider : string # your provider url, such as foo.okta.com
idp_arn : string, # the AWS IAM IDP arn
client_ids : list(string), # a list of oidc client ids
provider : string, # your provider url, such as foo.okta.com
jwt_condition: optional(string) # the condition to allow the JWT token
}
))

Expand Down
3 changes: 3 additions & 0 deletions aws-iam-role-crossacct/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform {
required_version = ">= 1.3.0"
}

0 comments on commit 5320504

Please sign in to comment.