From 17e6141d66e39c5adf9ce878bc49f1a35cb9724b Mon Sep 17 00:00:00 2001 From: Niall Thomson Date: Thu, 26 Oct 2023 02:44:13 +0000 Subject: [PATCH] Fixed some secrets manager issues with test repeatability, language corrections --- .../secrets-manager/.workshop/cleanup.sh | 16 +++++++ .../.workshop/terraform/addon.tf | 35 ++------------- .../external-secrets/external-secret.yaml | 2 +- .../external-secrets/kustomization.yaml | 4 +- .../mounting-secrets/kustomization.yaml | 3 +- .../mounting-secrets/serviceaccount.yaml | 7 +++ .../secret-provider-class.yaml | 2 +- .../secrets-management/_category_.json | 3 ++ .../secrets-manager/ascp.md | 7 +-- .../secrets-manager/create-secret.md | 11 +++-- .../secrets-manager/external-secrets.md | 33 +++++++------- .../secrets-manager/mounting-secrets.md | 44 ++++++++++--------- 12 files changed, 88 insertions(+), 79 deletions(-) create mode 100644 manifests/modules/security/secrets-manager/.workshop/cleanup.sh create mode 100644 manifests/modules/security/secrets-manager/mounting-secrets/serviceaccount.yaml create mode 100644 website/docs/security/secrets-management/_category_.json diff --git a/manifests/modules/security/secrets-manager/.workshop/cleanup.sh b/manifests/modules/security/secrets-manager/.workshop/cleanup.sh new file mode 100644 index 000000000..93561ab30 --- /dev/null +++ b/manifests/modules/security/secrets-manager/.workshop/cleanup.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +kubectl delete clustersecretstore cluster-secret-store --ignore-not-found > /dev/null + +kubectl delete SecretProviderClass catalog-spc -n catalog --ignore-not-found > /dev/null + +kubectl delete ExternalSecret catalog-external-secret -n catalog --ignore-not-found > /dev/null + +check=$(aws secretsmanager list-secrets --filters Key="name",Values="${SECRET_NAME}" --output text) + +if [ ! -z "$check" ]; then + echo "Deleting Secrets Manager data..." + aws secretsmanager delete-secret --secret-id ${SECRET_NAME} +fi \ No newline at end of file diff --git a/manifests/modules/security/secrets-manager/.workshop/terraform/addon.tf b/manifests/modules/security/secrets-manager/.workshop/terraform/addon.tf index 95b9a330f..bd6bbcfb2 100644 --- a/manifests/modules/security/secrets-manager/.workshop/terraform/addon.tf +++ b/manifests/modules/security/secrets-manager/.workshop/terraform/addon.tf @@ -82,35 +82,8 @@ resource "aws_iam_policy" "secrets_manager" { POLICY } -resource "kubernetes_annotations" "catalog-sa" { - api_version = "v1" - kind = "ServiceAccount" - metadata { - name = "catalog" - namespace = "catalog" - } - annotations = { - "eks.amazonaws.com/role-arn" = "${module.secrets_manager_role.iam_role_arn}" - } - force = true +output "environment" { + value = <