Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ Deploy Runner:
(cd <REPLACE_WITH_NAME_OF_ACCOUNT>/us-west-2/mgmt && terragrunt run-all apply)
```

**NOTE:** Because this uses `run-all`, the command will not pause to show you the plan. If you wish to view the plan,
:::note

Because this uses `run-all`, the command will not pause to show you the plan. If you wish to view the plan,
run `apply` in each subfolder of the `mgmt` folder, in dependency graph order. You can see the dependency graph by using
the [graph-dependencies terragrunt
command](https://terragrunt.gruntwork.io/docs/reference/cli-options/#graph-dependencies).

:::

At this point, the ECS Deploy Runner is provisioned in the new account, and you can start using the Gruntwork Pipeline
to provision new infrastructure in the account.
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Undeploying modules using Gruntwork Pipelines

...
To destroy a module with no downstream dependencies, such as `route53-private` in the `dev` environment:

1. Update the `force_destroy` variable in `dev/us-west-2/dev/networking/route53-private/terragrunt.hcl`.
([See the `force_destroy` section](./03-pre-requisite-force-destroy-on-s3-buckets.md).)

force_destroy = true

1. Open a pull request for that change and verify the plan in CI. You should see a trivial change to update the
module.
1. Go through the typical git workflow to get the change merged into the main branch.
1. As CI runs on the main branch, watch for the job to be held for approval. Approve the job, and wait for the
`deployment` step to complete so that the module is fully updated with the new variable.
1. Remove the module folder from the repo. For example:

rm -rf dev/us-west-2/dev/networking/route53-private

1. Open a pull request for that change and verify the plan in CI.
- Make sure the `plan -destroy` output looks accurate.
- If you are deleting multiple modules (e.g., in `dev`, `stage`, and `prod`) you should see multiple plan
outputs -- one per folder deleted. You'll need to scroll through the plan output to see all of them, as
it runs `plan -destroy` for each folder individually.
1. Go through the typical git workflow to get the change merged into the main branch.
1. As CI runs on the main branch, watch for the job to be held for approval. Approve the job, and wait for the
`deployment` step to complete so that the module is fully _deleted_.
1. [Remove the terraform state](./08-removing-the-terraform-state.md).

:::note

Repeat this process for upstream dependencies you may now want to destroy, always starting from the
modules that have no existing downstream dependencies.

:::
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ Deploy Runner:
(cd <REPLACE_WITH_NAME_OF_ACCOUNT>/us-west-2/mgmt && terragrunt run-all apply)
```

**NOTE:** Because this uses `run-all`, the command will not pause to show you the plan. If you wish to view the plan,
:::note

Because this uses `run-all`, the command will not pause to show you the plan. If you wish to view the plan,
run `apply` in each subfolder of the `mgmt` folder, in dependency graph order. You can see the dependency graph by using
the [graph-dependencies terragrunt
command](https://terragrunt.gruntwork.io/docs/reference/cli-options/#graph-dependencies).

:::

At this point, the ECS Deploy Runner is provisioned in the new account, and you can start using the Gruntwork Pipeline
to provision new infrastructure in the account.


<!-- ##DOCS-SOURCER-START
{"sourcePlugin":"Local File Copier","hash":"d45e6387b5fc09c9e6ced9d19a69a784"}
{"sourcePlugin":"Local File Copier","hash":"f383a1b3ce7b725423c02c57370d347b"}
##DOCS-SOURCER-END -->
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
# Undeploying modules using Gruntwork Pipelines

...
To destroy a module with no downstream dependencies, such as `route53-private` in the `dev` environment:

1. Update the `force_destroy` variable in `dev/us-west-2/dev/networking/route53-private/terragrunt.hcl`.
([See the `force_destroy` section](./03-pre-requisite-force-destroy-on-s3-buckets.md).)

force_destroy = true

1. Open a pull request for that change and verify the plan in CI. You should see a trivial change to update the
module.
1. Go through the typical git workflow to get the change merged into the main branch.
1. As CI runs on the main branch, watch for the job to be held for approval. Approve the job, and wait for the
`deployment` step to complete so that the module is fully updated with the new variable.
1. Remove the module folder from the repo. For example:

rm -rf dev/us-west-2/dev/networking/route53-private

1. Open a pull request for that change and verify the plan in CI.
- Make sure the `plan -destroy` output looks accurate.
- If you are deleting multiple modules (e.g., in `dev`, `stage`, and `prod`) you should see multiple plan
outputs -- one per folder deleted. You'll need to scroll through the plan output to see all of them, as
it runs `plan -destroy` for each folder individually.
1. Go through the typical git workflow to get the change merged into the main branch.
1. As CI runs on the main branch, watch for the job to be held for approval. Approve the job, and wait for the
`deployment` step to complete so that the module is fully _deleted_.
1. [Remove the terraform state](./08-removing-the-terraform-state.md).

:::note

Repeat this process for upstream dependencies you may now want to destroy, always starting from the
modules that have no existing downstream dependencies.

:::


<!-- ##DOCS-SOURCER-START
{"sourcePlugin":"Local File Copier","hash":"5a713398c4c7a21365cc14d9e31323b3"}
{"sourcePlugin":"Local File Copier","hash":"b29d1696372fb2955b41113f2eee5f96"}
##DOCS-SOURCER-END -->