FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 29630df9 authored by Dmitrii Unterov's avatar Dmitrii Unterov
Browse files

chore: add known-issues.md file

parent 3099b008
No related branches found
No related tags found
No related merge requests found
Pipeline #604772 waiting for manual action
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
## Manual Deletion Required for Static IP Address ## Manual Deletion Required for Static IP Address
This module has `prevent_deletion` attribute enabled for `google_compute_address.static_ip` `prevent_deletion` attribute is enabled for the `google_compute_address.static_ip` resource.
resource. This attribute is used to prevent accidental deletion of important resources. This attribute is used to prevent accidental deletion of important resources.
It was done on purpose, as it is not expected that static IPs to be regularly removed It is generally not expected for static IP addresses to be deleted or recreated frequently,
and recreated, as it's likely that they will be used within firewall, DNS records and so on. as these are often referenced in other external configurations such as firewall rules and DNS
Terraform will display error trying to destroy the resource: records.
with `prevent_deletion` applied, Terraform will display error trying to destroy the resource:
```sh ```sh
│ Error: Instance cannot be destroyed │ Error: Instance cannot be destroyed
...@@ -20,15 +23,16 @@ Terraform will display error trying to destroy the resource: ...@@ -20,15 +23,16 @@ Terraform will display error trying to destroy the resource:
However, sometimes it needs to be deleted. If a resource is created with `prevent_deletion`, However, sometimes it needs to be deleted. If a resource is created with `prevent_deletion`,
Terraform will block any attempt to delete this resource through Terraform commands. Terraform will block any attempt to delete this resource through Terraform commands.
As a result, if you need to remove such a resource from your Terraform configuration, In some situations, it is necessary to delete static IP Address entries. In order to do this with
you must manually delete the resource outside of Terraform before running `terraform apply` again. `prevent_deletion` enabled, you must first manually delete the resource via the console or `gcloud`
cli tool before running `terraform apply`.
The steps below shows how it can be achieved. A full example of this is shown below.
## Steps to Resolve
First, delete the resources that use the IP address. In common case it is Cloud Router with the ## Manually deleting a static IP address with `prevent_deletion` attribute
default name `webapp-ip-router`. If not sure, check the list of routers using `gcloud` command:
1. Confirm the name of the Cloud Router using the `gcloud` command:
```sh ```sh
gcloud compute routers list --project $PROJECT_ID gcloud compute routers list --project $PROJECT_ID
...@@ -37,16 +41,24 @@ NAME REGION NETWORK ...@@ -37,16 +41,24 @@ NAME REGION NETWORK
webapp-ip-router europe-west2 default webapp-ip-router europe-west2 default
``` ```
Delete the Cloud Router: Default name for the resource created within this module is `webapp-ip-router`.
2. Delete the Cloud Router:
```sh ```sh
gcloud compute routers delete webapp-ip-router --project $PROJECT_ID --region $REGION gcloud compute routers delete webapp-ip-router --project $PROJECT_ID --region $REGION
``` ```
Now the IP address can be deleted: 3. Delete the IP address:
```sh ```sh
gcloud compute addresses delete webapp-static-ip --region $REGION --project $PROJECT_ID gcloud compute addresses delete webapp-static-ip --region $REGION --project $PROJECT_ID
``` ```
4. Verify that the IP address is deleted:
```sh
gcloud compute addresses list --project $PROJECT_ID
```
That's it. Now Terraform commands will work without errors. That's it. Now Terraform commands will work without errors.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment