Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Add option to deploy collector CF stack only in specific regions #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Options:
-s3bu --s3-bucket The S3 bucket where the code package will be uploaded
-s3pr --s3-profile A separate AWS credential profile to upload code packages to the S3 Bucket
-rv --release-version The release version to deploy, e.g. '0.5.2' or 'latest'
-cr --collector-regions Regions where the collector CloudFormation stack will be deployed (space separated)

-lr --log-retention-days The number of days to retain the Lambda Function's logs (default: 90)
-ld --log-level-debug Enable the debug logging for the Lambda Function
Expand Down Expand Up @@ -121,6 +122,12 @@ Create the infrastructure with the latest release using either the `default`, `$
./deploy_autotag.sh --region us-west-2 --s3-bucket my-autotag-bucket --release-version latest create
```

Create the infrastructure that tags resources only in specific regions.

```bash
./deploy_autotag.sh --region us-west-2 --s3-bucket my-autotag-bucket --release-version latest --collector-regions us-west-1 us-west-2 eu-west-1 create
```

Create the infrastructure with the latest release using a named AWS credentials profile.

```bash
Expand Down
14 changes: 12 additions & 2 deletions deploy_autotag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ EOF

# Deploy Collector CloudFormation Template

ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions | sort_by(.RegionName) | .[].RegionName')
[[ -z $ACTIVE_REGIONS ]] && ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions | sort_by(.RegionName) | .[].RegionName')

for REGION in $ACTIVE_REGIONS ; do

Expand Down Expand Up @@ -441,7 +441,7 @@ EOF

wait-for-stack 'Main' "$MAIN_STACK_NAME" "$MAIN_STACK_AWS_REGION"

ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions[].RegionName')
[[ -z $ACTIVE_REGIONS ]] && ACTIVE_REGIONS=$(aws ec2 describe-regions $AWS_CREDENTIALS --region "$MAIN_STACK_AWS_REGION" | jq -r '.Regions[].RegionName')

for REGION in $ACTIVE_REGIONS ; do

Expand Down Expand Up @@ -639,6 +639,7 @@ Options:
-s3bu --s3-bucket The S3 bucket where the code package will be uploaded
-s3pr --s3-profile A separate AWS credential profile to upload code packages to the S3 Bucket
-rv --release-version The release version to deploy, e.g. '0.5.2' or 'latest'
-cr --collector-regions Regions where the collector CloudFormation stack will be deployed (space separated)

-lr --log-retention-days The number of days to retain the Lambda Function's logs (default: 90)
-ld --log-level-debug Enable the debug logging for the Lambda Function
Expand All @@ -651,6 +652,7 @@ EOF
}

PARAMS=''
ACTIVE_REGIONS=''
while (( "$#" )); do
case "$1" in
-h|--help)
Expand All @@ -676,6 +678,14 @@ while (( "$#" )); do
export RELEASE_VERSION=$2
shift 2
;;
-cr|--collector-regions)
while [[ $2 != -* && $# -gt 1 ]]; do
ACTIVE_REGIONS="$ACTIVE_REGIONS $2"
shift
done
ACTIVE_REGIONS="${ACTIVE_REGIONS#"${ACTIVE_REGIONS%%[![:space:]]*}"}"
shift
;;
-lr|--log-retention-days)
export LOG_RETENTION_DAYS=$2
shift 2
Expand Down