Skip to content

Commit

Permalink
adding source role arns to trust policies
Browse files Browse the repository at this point in the history
  • Loading branch information
abiju-czi committed Sep 19, 2022
1 parent a96bc38 commit 71047a9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aws-assume-role-policy/module_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test

import (
"fmt"
"testing"

"github.com/chanzuckerberg/go-misc/tftest"
Expand All @@ -24,6 +25,7 @@ func TestAWSAssumeRolePolicy(t *testing.T) {
tftest.IAMRegion,
map[string]interface{}{
"source_account_ids": []string{curAcct},
"source_role_arns": []string{fmt.Sprintf("arn:aws:iam::%s:role/okta-czi-admin", curAcct)},
"saml_idp_arns": []string{"samlARN1", "samlARN2"},
"oidc": oidcCfg,
},
Expand Down
1 change: 1 addition & 0 deletions aws-iam-role-crossacct/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module "assume_role_policy" {
source = "../aws-assume-role-policy"
source_account_ids = var.source_account_ids
saml_idp_arns = var.saml_idp_arns
source_role_arns = var.source_role_arns
oidc = var.oidc
env = var.env
owner = var.owner
Expand Down
2 changes: 2 additions & 0 deletions aws-iam-role-crossacct/module_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test

import (
"fmt"
"testing"

"github.com/chanzuckerberg/go-misc/tftest"
Expand All @@ -20,6 +21,7 @@ func TestAWSIAMRoleCrossAcct(t *testing.T) {
map[string]interface{}{
"role_name": random.UniqueId(),
"source_account_ids": []string{curAcct},
"source_role_arns": []string{fmt.Sprintf("arn:aws:iam::%s:role/okta-czi-admin", curAcct)},
},
)
},
Expand Down
6 changes: 6 additions & 0 deletions aws-iam-role-crossacct/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ variable "saml_idp_arns" {
description = "The AWS SAML IDP arns to establish a trust relationship. Ignored if empty or not provided."
}

variable "source_role_arns" {
type = list(string)
description = "The source AWS roles to establish a trust relationship. Ignored if empty or not provided."
default = []
}

variable "oidc" {
type = list(object(
{
Expand Down

0 comments on commit 71047a9

Please sign in to comment.