secretsmanager.go 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. package aws
  13. import (
  14. // nolint
  15. . "github.com/onsi/ginkgo/v2"
  16. "github.com/external-secrets/external-secrets-e2e/framework"
  17. awscommon "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/aws"
  18. "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/common"
  19. esapi "github.com/external-secrets/external-secrets/apis/externalsecrets/v1"
  20. )
  21. const (
  22. withStaticAuth = "with static auth"
  23. withExtID = "with externalID"
  24. withSessionTags = "with session tags"
  25. )
  26. var _ = Describe("[aws] ", Label("aws", "secretsmanager"), func() {
  27. f := framework.New("eso-aws-sm")
  28. prov := NewFromEnv(f)
  29. DescribeTable("sync secrets",
  30. framework.TableFuncWithExternalSecret(f,
  31. prov),
  32. framework.Compose(withStaticAuth, f, common.SimpleDataSync, useStaticAuth),
  33. framework.Compose(withStaticAuth, f, common.NestedJSONWithGJSON, useStaticAuth),
  34. framework.Compose(withStaticAuth, f, common.JSONDataFromSync, useStaticAuth),
  35. framework.Compose(withStaticAuth, f, common.JSONDataFromRewrite, useStaticAuth),
  36. framework.Compose(withStaticAuth, f, common.JSONDataWithProperty, useStaticAuth),
  37. framework.Compose(withStaticAuth, f, common.JSONDataWithTemplate, useStaticAuth),
  38. framework.Compose(withStaticAuth, f, common.DockerJSONConfig, useStaticAuth),
  39. framework.Compose(withStaticAuth, f, common.DataPropertyDockerconfigJSON, useStaticAuth),
  40. framework.Compose(withStaticAuth, f, common.SSHKeySync, useStaticAuth),
  41. framework.Compose(withStaticAuth, f, common.SSHKeySyncDataProperty, useStaticAuth),
  42. framework.Compose(withStaticAuth, f, common.SyncWithoutTargetName, useStaticAuth),
  43. framework.Compose(withStaticAuth, f, common.JSONDataWithoutTargetName, useStaticAuth),
  44. framework.Compose(withStaticAuth, f, common.FindByName, useStaticAuth),
  45. framework.Compose(withStaticAuth, f, common.FindByNameWithPath, useStaticAuth),
  46. framework.Compose(withStaticAuth, f, common.FindByTag, useStaticAuth),
  47. framework.Compose(withStaticAuth, f, common.FindByTagWithPath, useStaticAuth),
  48. framework.Compose(withStaticAuth, f, common.DeletionPolicyDelete, useStaticAuth),
  49. // referent auth
  50. framework.Compose(withStaticAuth, f, common.SimpleDataSync, useReferentStaticAuth),
  51. // test assume role with external-id and session tags
  52. framework.Compose(withExtID, f, SimpleSyncWithNamespaceTags(prov), useExtIDAuth),
  53. framework.Compose(withSessionTags, f, SimpleSyncWithNamespaceTags(prov), useSessionTagsAuth),
  54. )
  55. })
  56. func useStaticAuth(tc *framework.TestCase) {
  57. tc.ExternalSecret.Spec.SecretStoreRef.Name = awscommon.StaticStoreName
  58. }
  59. func useExtIDAuth(tc *framework.TestCase) {
  60. tc.ExternalSecret.Spec.SecretStoreRef.Name = awscommon.ExternalIDStoreName
  61. }
  62. func useSessionTagsAuth(tc *framework.TestCase) {
  63. tc.ExternalSecret.Spec.SecretStoreRef.Name = awscommon.SessionTagsStoreName
  64. }
  65. func useReferentStaticAuth(tc *framework.TestCase) {
  66. tc.ExternalSecret.Spec.SecretStoreRef.Name = awscommon.ReferentSecretStoreName(tc.Framework)
  67. tc.ExternalSecret.Spec.SecretStoreRef.Kind = esapi.ClusterSecretStoreKind
  68. }