Skip to content

Commit

Permalink
[AWSMC-1069] Update templates to use v2 API and support UPDATE (#129)
Browse files Browse the repository at this point in the history
Co-authored-by: jvanbrie <jon.vanbriesen@datadoghq.com>
  • Loading branch information
ktmq and jvanbrie authored Nov 11, 2024
1 parent 811e548 commit d641470
Show file tree
Hide file tree
Showing 12 changed files with 732 additions and 623 deletions.
302 changes: 194 additions & 108 deletions aws_organizations/main_organizations.yaml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions aws_organizations/taskcat/.taskcat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
general:
auth:
default: "<REPLACE_AWS_PROFILE>"
s3_bucket: datadog-cloudformation-templates-aws-taskcat-test

project:
name: aws-organizations
regions:
- us-east-2
tests:
default:
template: ./main_organizations.yaml
parameters:
DatadogApiKey: "<REPLACE_DD_API_KEY>"
DatadogAppKey: "<REPLACE_DD_APP_KEY>"
DatadogSite: "datad0g.com"
IAMRoleName: "DatadogIntegrationRole-taskcat-$[taskcat_random-string]"
DisableMetricCollection: "false"
CloudSecurityPostureManagement: "false"
19 changes: 19 additions & 0 deletions aws_organizations/taskcat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# How to run taskcat tests

## Setup
```
export DD_API_KEY=<api key for test datadog org>
export DD_APP_KEY=<app key for test datadog org>
export AWS_SSO_PROFILE_NAME=<sso profile name for test aws account>
```

### Run
```
./run-taskcat-test.sh
```

### Cleanup
```
# To delete test stacks, run:
taskcat test clean aws-organizations -a ${AWS_SSO_PROFILE_NAME}
```
41 changes: 41 additions & 0 deletions aws_organizations/taskcat/run-taskcat-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

if [ -z "$AWS_SSO_PROFILE_NAME" ]; then
echo "Missing AWS_SSO_PROFILE_NAME - Must specify an AWS profile name"
exit 1
fi

aws sso login --profile ${AWS_SSO_PROFILE_NAME}

TASKCAT_S3_BUCKET="datadog-cloudformation-templates-aws-taskcat-test"
TASKCAT_PROJECT="aws-organizations"

if [ -z "$DD_API_KEY" ]; then
echo "Missing DD_API_KEY - Must specify a Datadog API key"
exit 1
fi

if [ -z "$DD_APP_KEY" ]; then
echo "Missing DD_APP_KEY - Must specify a Datadog APP key"
exit 1
fi

if ! docker info > /dev/null 2>&1; then
echo "This script uses docker, and it isn't running - please start docker and try again!"
exit 1
fi

mkdir -p ./tmp

for f in ../*.yaml; do
sed "s|<BUCKET_PLACEHOLDER>.s3.amazonaws.com/aws/<VERSION_PLACEHOLDER>|${TASKCAT_S3_BUCKET}.s3.amazonaws.com/${TASKCAT_PROJECT}|g" $f > ./tmp/$(basename $f)
done

sed "s|<REPLACE_DD_API_KEY>|${DD_API_KEY}|g ; s|<REPLACE_DD_APP_KEY>|${DD_APP_KEY}|g ; s|<REPLACE_AWS_PROFILE>|${AWS_SSO_PROFILE_NAME}|g" ./.taskcat.yml > ./tmp/.taskcat.yml

taskcat upload -b ${TASKCAT_S3_BUCKET} -k ${TASKCAT_PROJECT} -p tmp

taskcat test run --skip-upload --project-root tmp --no-delete

echo "To delete test stacks, run:"
echo " taskcat test clean ${TASKCAT_PROJECT} -a ${AWS_SSO_PROFILE_NAME}"
221 changes: 0 additions & 221 deletions aws_quickstart/datadog_integration_api_call.yaml

This file was deleted.

Loading

0 comments on commit d641470

Please sign in to comment.