-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace KIAM with IRSA for Velero (#427)
* Replace KIAM with IRSA for Velero. Now supports cross account setup Signed-off-by: Audun Nes <[email protected]> * Remove unused kiam_server_role_arn variable Signed-off-by: Audun Nes <[email protected]> * Use aws_iam_oidc_provider from sub module Signed-off-by: Audun Nes <[email protected]> * Cleanup QA more controlled due to dependency between EKS account and Velero S3 bucket account Signed-off-by: Audun Nes <[email protected]> * Fix typo in function name Signed-off-by: Audun Nes <[email protected]>
- Loading branch information
Showing
7 changed files
with
129 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -------------------------------------------------- | ||
# OIDC Provider URL | ||
# -------------------------------------------------- | ||
|
||
# When var.eks_cluster_name is supplied, we will use | ||
# the EKS data provider to fetch the oidc_provider_url | ||
# Since data providers don't work across accounts, | ||
# using var.eks_cluster_name only make sense if the | ||
# EKS cluster and the S3 bucket for Velero are in | ||
# the same AWS account. | ||
# | ||
# Hence for our sandbox environments and QA: | ||
# 1. ONLY provide var.eks_cluster_name AND var.bucket_name | ||
# | ||
# For our production environments: | ||
# 1. ONLY provide var.oidc_provider_url AND var.bucket_name | ||
|
||
data "aws_eks_cluster" "eks" { | ||
count = var.eks_cluster_name != null ? 1 : 0 | ||
name = var.eks_cluster_name | ||
} | ||
|
||
locals { | ||
oidc_provider_url = var.oidc_provider_url == null ? ( | ||
data.aws_eks_cluster.eks[0].identity[0].oidc[0].issuer) : ( | ||
var.oidc_provider_url | ||
) | ||
} | ||
|
||
# -------------------------------------------------- | ||
# Caller identity and additional OIDC properties | ||
# -------------------------------------------------- | ||
|
||
data "aws_caller_identity" "current" {} | ||
|
||
data "tls_certificate" "oidc_provider" { | ||
url = local.oidc_provider_url | ||
} | ||
|
||
locals { | ||
account_id = data.aws_caller_identity.current.account_id | ||
oidc_provider_server_id = trim(local.oidc_provider_url, "https://") | ||
oidc_provider_arn = "arn:aws:iam::${local.account_id}:oidc-provider/${local.oidc_provider_server_id}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters