Skip to content

Commit

Permalink
Delete environment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ben851 committed Dec 16, 2024
1 parent b9c72ef commit ea0197f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions aws/common/newrelic.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ resource "newrelic_api_access_key" "newrelic_aws_access_key" {
count = var.enable_new_relic && var.env != "production" ? 1 : 0
account_id = var.new_relic_account_id
key_type = "USER"
name = "notify_tf_provider"
name = var.env == "staging" ? "notify_tf_provider" : "notify_tf_provider_${var.env}"
notes = "Used by Notify Terraform Code to create New Relic Resources"
}

Expand Down Expand Up @@ -119,8 +119,8 @@ EOF
resource "random_string" "s3-bucket-name" {
count = var.enable_new_relic && var.env != "production" ? 1 : 0
length = 8
special = true
upper = true
special = false
upper = false
}

resource "aws_s3_bucket" "newrelic_aws_bucket" {
Expand Down
2 changes: 1 addition & 1 deletion env/dev_config.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ notification_queue_prefix = "eks-notification-canada-ca"

# ENVIRONMENT
enable_new_relic = true
create_cbs_bucket = true
create_cbs_bucket = false
force_destroy_s3 = true
force_delete_ecr = true
force_destroy_athena = true
Expand Down
3 changes: 3 additions & 0 deletions scripts/deleteEnvironment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ echo "Done."
echo "Deleting Cloud Based Sensor S3 Bucket..."
pushd ../env/$ENVIRONMENT/common
terragrunt destroy -var-file ../$ENVIRONMENT.tfvars --target module.cbs_logs_bucket --terragrunt-non-interactive -auto-approve
terragrunt destroy -var-file ../$ENVIRONMENT.tfvars --target 'newrelic_cloud_aws_link_account.newrelic_cloud_integration_push[0]' --terragrunt-non-interactive -auto-approve
terragrunt destroy -var-file ../$ENVIRONMENT.tfvars --target 'newrelic_api_access_key.newrelic_aws_access_key[0]' --terragrunt-non-interactive -auto-approve
terragrunt destroy -var-file ../$ENVIRONMENT.tfvars --target 'newrelic_cloud_aws_link_account.newrelic_cloud_integration_pull[0]' --terragrunt-non-interactive -auto-approve
popd
echo "Done."

Expand Down

0 comments on commit ea0197f

Please sign in to comment.