Skip to content

Commit 3fb6212

Browse files
committed
feat(github-oidc-ecr): allow existing OIDC provider to be used
1 parent 593f463 commit 3fb6212

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

modules/github-oidc-ecr/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
module "oidc_provider" {
44
source = "philips-labs/github-oidc/aws//modules/provider"
55
version = "0.8.1"
6+
7+
count = var.openid_connect_provider_arn == null ? 1 : 0
68
}
79

810
module "repo_oidc_label" {
@@ -22,7 +24,7 @@ module "repo_oidc" {
2224

2325
for_each = var.github_repositories
2426

25-
openid_connect_provider_arn = module.oidc_provider.openid_connect_provider.arn
27+
openid_connect_provider_arn = coalesce(var.openid_connect_provider_arn, join("", module.oidc_provider.*.openid_connect_provider.arn))
2628
repo = each.key
2729
role_name = module.repo_oidc_label[each.key].id
2830

modules/github-oidc-ecr/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
variable "openid_connect_provider_arn" {
3+
description = "Set the openid connect provider ARN when the provider is not managed by the module."
4+
type = string
5+
default = null
6+
}
7+
8+
29
variable "github_repositories" {
310
description = "Map of GitHub repositories to create OIDC roles for keyed by repo name"
411
type = map(object({

0 commit comments

Comments
 (0)