Skip to content

Commit

Permalink
Fixed comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tuteng committed Jan 2, 2025
1 parent 9429ef5 commit f05e13a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
14 changes: 0 additions & 14 deletions modules/aws/volume-access/check_oidc_providers.sh

This file was deleted.

21 changes: 4 additions & 17 deletions modules/aws/volume-access/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,19 @@ locals {
},
{
provider : "${value}",
test : "StringEquals",
test : "StringLike",
variable : "${value}:sub",
values : [format("system:serviceaccount:%s:*", var.external_id)]
}
]
]
}

data "external" "check_oidc_provider" {
program = ["bash", "${path.module}/check_oidc_providers.sh"]
query = {
account_id = local.account_id
oidc_providers_str = join(" ", local.oidc_providers)
}
}

locals {
provider_not_exists = compact(split(" ", data.external.check_oidc_provider.result.oidc_providers))
}

resource "aws_iam_openid_connect_provider" "oidc_provider" {
count = length(local.provider_not_exists)
url = "https://${local.provider_not_exists[count.index]}"
resource "aws_iam_openid_connect_provider" "streamnative_oidc_providers" {
count = var.init_oidc_providers ? length(local.oidc_providers): 0
url = "https://${var.oidc_providers[count.index]}"
client_id_list = ["sts.amazonaws.com"]
tags = local.tag_set
depends_on = [data.external.check_oidc_provider]
}

data "aws_iam_policy_document" "streamnative_management_access" {
Expand Down
6 changes: 6 additions & 0 deletions modules/aws/volume-access/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ variable "oidc_providers" {
default = []
description = "Your aws eks cluster OIDC Providers"
type = list(string)
}

variable "init_oidc_providers" {
default = true
description = ""
type = bool
}

0 comments on commit f05e13a

Please sign in to comment.