Skip to content

Commit

Permalink
remove delete of route table and nacl
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Apr 8, 2021
1 parent 2c45a67 commit 0d62bc1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion vpc-remove-defaults/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ To remove all the defaults, which is what we are required to do, you need a few
tf-plan -target=module.vpc_defaults
tf-apply -target=module.vpc_defaults
tf-destory -target=module.vpc_defaults
setup/delete-defaults.sh true |& tee setup/delete-defaults.sh.log
setup/delete-defaults.sh true |& tee delete-defaults.sh.log
```
Once all of the defaults are removed, you'll need to disable the associated .tf or remove the module code
which brought in the defaults. Running it a second time with no actual defaults will fail.
Expand Down
2 changes: 1 addition & 1 deletion vpc-remove-defaults/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* tf-plan -target=module.vpc_defaults
* tf-apply -target=module.vpc_defaults
* tf-destory -target=module.vpc_defaults
* setup/delete-defaults.sh true |& tee setup/delete-defaults.sh.log
* setup/delete-defaults.sh true |& tee delete-defaults.sh.log
* ```
* Once all of the defaults are removed, you'll need to disable the associated .tf or remove the module code
* which brought in the defaults. Running it a second time with no actual defaults will fail.
Expand Down
12 changes: 7 additions & 5 deletions vpc-remove-defaults/templates/delete-defaults.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi

if [ ! -z "${security_group}" ]
then
echo "# AWS does not permit the delete of the default security group ${security_group}"
echo "# default security group ${security_group} removed after VPC is removed"
# echo "# aws --profile ${profile} --region ${region} ec2 delete-security-group --group-id ${security_group} $DRYRUN"
# aws --profile ${profile} --region ${region} ec2 delete-security-group --group-id ${security_group} $DRYRUN
else
Expand Down Expand Up @@ -74,16 +74,18 @@ fi

if [ ! -z "${network_acl}" ]
then
echo "# aws --profile ${profile} --region ${region} ec2 delete-network-acl --network-acl-id ${network_acl} $DRYRUN"
aws --profile ${profile} --region ${region} ec2 delete-network-acl --network-acl-id ${network_acl} $DRYRUN
echo "# default network acl ${nework_acl} removed after VPC is removed"
# echo "# aws --profile ${profile} --region ${region} ec2 delete-network-acl --network-acl-id ${network_acl} $DRYRUN"
# aws --profile ${profile} --region ${region} ec2 delete-network-acl --network-acl-id ${network_acl} $DRYRUN
else
echo "# skipping delete network_acl, missing"
fi

if [ ! -z "${route_table}" ]
then
echo "# aws --profile ${profile} --region ${region} ec2 delete-route-table --route-table-id ${route_table} $DRYRUN"
aws --profile ${profile} --region ${region} ec2 delete-route-table --route-table-id ${route_table} $DRYRUN
echo "# default route table ${route_table} removed after VPC is removed"
# echo "# aws --profile ${profile} --region ${region} ec2 delete-route-table --route-table-id ${route_table} $DRYRUN"
# aws --profile ${profile} --region ${region} ec2 delete-route-table --route-table-id ${route_table} $DRYRUN
else
echo "# skipping delete route_table, missing"
fi
Expand Down

0 comments on commit 0d62bc1

Please sign in to comment.