diff --git a/manifests/modules/security/secrets-manager/.workshop/terraform/addon.tf b/manifests/modules/security/secrets-manager/.workshop/terraform/addon.tf new file mode 100644 index 000000000..95b9a330f --- /dev/null +++ b/manifests/modules/security/secrets-manager/.workshop/terraform/addon.tf @@ -0,0 +1,116 @@ +module "secrets-store-csi-driver" { + source = "github.com/aws-ia/terraform-aws-eks-blueprints?ref=v4.32.1//modules/kubernetes-addons/secrets-store-csi-driver" + + helm_config = { + version = "1.3.4" + set = [{ + name = "syncSecret.enabled" + value = true + }, + { + name = "enableSecretRotation" + value = true + }] + } + + addon_context = local.addon_context +} + +module "secrets_store_csi_driver_provider_aws" { + source = "github.com/aws-ia/terraform-aws-eks-blueprints?ref=v4.32.1//modules/kubernetes-addons/csi-secrets-store-provider-aws" + + helm_config = { + version = "0.3.4" + } + + addon_context = local.addon_context +} + +module "external_secrets" { + source = "github.com/aws-ia/terraform-aws-eks-blueprints?ref=v4.32.1//modules/kubernetes-addons/external-secrets" + + helm_config = { + version = "0.9.5" + } + + addon_context = local.addon_context +} + +module "secrets_manager_role" { + source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks" + version = "~> 5.30" + + role_name_prefix = "${data.aws_eks_cluster.eks_cluster.id}-secrets-manager-" + + role_policy_arns = { + policy = aws_iam_policy.secrets_manager.arn + } + + oidc_providers = { + main = { + provider_arn = "arn:${data.aws_partition.current.partition}:iam::${data.aws_caller_identity.current.account_id}:oidc-provider/${local.eks_oidc_issuer_url}" + namespace_service_accounts = ["catalog:catalog"] + } + } + + tags = local.tags +} + +resource "aws_iam_policy" "secrets_manager" { + name_prefix = "${data.aws_eks_cluster.eks_cluster.id}-secrets-manager-" + policy = <