-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds conformance tests for AWS Secrets store component (#3588)
Signed-off-by: Elena Kolevska <[email protected]> Co-authored-by: Yaron Schneider <[email protected]>
- Loading branch information
1 parent
9833e56
commit b05e19a
Showing
13 changed files
with
179 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "3.8" | ||
|
||
services: | ||
localstack: | ||
container_name: "conformance-aws-secrets-manager" | ||
image: localstack/localstack | ||
ports: | ||
- "127.0.0.1:4566:4566" | ||
environment: | ||
- DEBUG=1 | ||
- DOCKER_HOST=unix:///var/run/docker.sock | ||
volumes: | ||
- "${PWD}/.github/scripts/docker-compose-init/init-conformance-state-aws-secrets-manager.sh:/etc/localstack/init/ready.d/init-aws.sh" # ready hook | ||
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack" | ||
- "/var/run/docker.sock:/var/run/docker.sock" |
54 changes: 54 additions & 0 deletions
54
...ub/infrastructure/terraform/conformance/secretstores/aws/secretsmanager/secretsmanager.tf
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,54 @@ | ||
terraform { | ||
required_version = ">=0.13" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 4.0" | ||
} | ||
} | ||
} | ||
|
||
variable "TIMESTAMP" { | ||
type = string | ||
description = "Timestamp of the GitHub workflow run." | ||
} | ||
|
||
variable "UNIQUE_ID" { | ||
type = string | ||
description = "Unique ID of the GitHub workflow run." | ||
} | ||
|
||
provider "aws" { | ||
region = "us-east-1" | ||
default_tags { | ||
tags = { | ||
Purpose = "AutomatedConformanceTesting" | ||
Timestamp = "${var.TIMESTAMP}" | ||
} | ||
} | ||
} | ||
|
||
# Create the first secret in AWS Secrets Manager | ||
resource "aws_secretsmanager_secret" "conftestsecret" { | ||
name = "conftestsecret" | ||
description = "Secret for conformance test" | ||
recovery_window_in_days = 0 | ||
} | ||
|
||
resource "aws_secretsmanager_secret_version" "conftestsecret_value" { | ||
secret_id = aws_secretsmanager_secret.conftestsecret.id | ||
secret_string = "abcd" | ||
} | ||
|
||
# Create the second secret in AWS Secrets Manager | ||
resource "aws_secretsmanager_secret" "secondsecret" { | ||
name = "secondsecret" | ||
description = "Another secret for conformance test" | ||
recovery_window_in_days = 0 | ||
} | ||
|
||
resource "aws_secretsmanager_secret_version" "secondsecret_value" { | ||
secret_id = aws_secretsmanager_secret.secondsecret.id | ||
secret_string = "efgh" | ||
} |
9 changes: 9 additions & 0 deletions
9
.../components-scripts/conformance-secretstores.aws.secretsmanager.secretsmanager-destroy.sh
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,9 @@ | ||
#!/bin/sh | ||
|
||
set +e | ||
|
||
# Navigate to the Terraform directory | ||
cd ".github/infrastructure/terraform/conformance/secretstores/aws/secretsmanager" | ||
|
||
# Run Terraform | ||
terraform destroy -auto-approve -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME" |
15 changes: 15 additions & 0 deletions
15
...ts/components-scripts/conformance-secretstores.aws.secretsmanager.secretsmanager-setup.sh
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,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Set variables for GitHub Actions | ||
echo "AWS_REGION=us-east-1" >> $GITHUB_ENV | ||
|
||
# Navigate to the Terraform directory | ||
cd ".github/infrastructure/terraform/conformance/secretstores/aws/secretsmanager" | ||
|
||
# Run Terraform | ||
terraform init | ||
terraform validate -no-color | ||
terraform plan -no-color -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME" | ||
terraform apply -auto-approve -var="UNIQUE_ID=$UNIQUE_ID" -var="TIMESTAMP=$CURRENT_TIME" |
9 changes: 9 additions & 0 deletions
9
.github/scripts/docker-compose-init/init-conformance-state-aws-secrets-manager.sh
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,9 @@ | ||
#!/bin/bash | ||
|
||
awslocal secretsmanager create-secret \ | ||
--name conftestsecret \ | ||
--secret-string "abcd" | ||
|
||
awslocal secretsmanager create-secret \ | ||
--name secondsecret \ | ||
--secret-string "efgh" |
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,19 @@ | ||
# yaml-language-server: $schema=../../../component-metadata-schema.json | ||
schemaVersion: v1 | ||
type: secretstores | ||
name: aws.secretsmanager | ||
version: v1 | ||
status: beta | ||
title: "AWS Secrets manager" | ||
urls: | ||
- title: Reference | ||
url: https://docs.dapr.io/reference/components-reference/supported-secret-stores/aws-secret-manager/ | ||
builtinAuthenticationProfiles: | ||
- name: "aws" | ||
metadata: | ||
- name: endpoint | ||
required: false | ||
description: | | ||
The Secrets manager endpoint. The AWS SDK will generate a default endpoint if not specified. Useful for local testing with AWS LocalStack | ||
example: '"http://localhost:4566"' | ||
type: string |
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
16 changes: 16 additions & 0 deletions
16
tests/config/secretstores/aws/secretsmanager/docker/secretsmanager.yml
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,16 @@ | ||
apiVersion: dapr.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: awssecretmanager | ||
spec: | ||
type: secretstores.aws.secretmanager | ||
version: v1 | ||
metadata: | ||
- name: endpoint | ||
value: "http://localhost:4566" # AWS LocalStack address | ||
- name: accessKey | ||
value: "test" # AWS LocalStack placeholder | ||
- name: secretKey | ||
value: "test" # AWS LocalStack placeholder | ||
- name: region | ||
value: "us-east-1" # AWS LocalStack placeholder |
15 changes: 15 additions & 0 deletions
15
tests/config/secretstores/aws/secretsmanager/terraform/secretsmanager.yml
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,15 @@ | ||
apiVersion: dapr.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: awssecretmanager | ||
namespace: default | ||
spec: | ||
type: secretstores.aws.secretmanager | ||
version: v1 | ||
metadata: | ||
- name: accessKey | ||
value: ${{AWS_ACCESS_KEY_ID}} | ||
- name: secretKey | ||
value: ${{AWS_SECRET_ACCESS_KEY}} | ||
- name: region | ||
value: ${{AWS_REGION}} |
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