Skip to content

Commit

Permalink
Add a script for tainting all assessment instances
Browse files Browse the repository at this point in the history
Note that this does not include the Guacamole or Samba instances.
  • Loading branch information
jsf9k committed Oct 6, 2024
1 parent 7e92577 commit 2586eef
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions taint_all_assessment_instances.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail

# A script for tainting all assessment instance types in
# cisagov/cool-assessment-terraform. Note that this does not include
# the Guacamole or Samba instances.
#
# Example:
# $ AWS_PROFILE=cool-user AWS_SHARED_CREDENTIALS_FILE=~/.aws/production_credentials AWS_DEFAULT_REGION=us-east-1 ./taint_all_assessment_instances.sh

# Export some environment variables that we want the terraform child
# processes to inherit.
export AWS_PROFILE
export AWS_SHARED_CREDENTIALS_FILE
export AWS_DEFAULT_REGION

INSTANCES=$(terraform state list \
| sed --expression '/^aws_instance\.\(guacamole\|samba\)$/d' \
--expression '/^aws_instance\..*$/p' \
--quiet)

for instance in $INSTANCES; do
terraform taint "$instance"
done

0 comments on commit 2586eef

Please sign in to comment.