Skip to content

Commit 300b46b

Browse files
committed
docs: Add warning that explains changing ignore_vpc
1 parent 4ccd567 commit 300b46b

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,42 @@ module "zone" {
197197
>
198198
> Hence why the `aws_route53_zone_association` resource is *outside* the scope of the module, but the authorization (`aws_route53_vpc_association_authorization`) is *inside* the scope of the module.
199199
200+
> [!CAUTION]
201+
> Since Terraform does not support variables in the `lifecycle_block`, the `ignore_vpc` variable is used to switch between two resources: `aws_route53_zone.this` and `aws_route53_zone.ignore_vpc`.
202+
> Therefore, if you changes this value after resources have been created, Terraform will attempt to destroy and recreate the Route53 zone which is usually not desired. To avoid this,
203+
> you will need to perform the appropriate state move commands/blocks between the two resources.
204+
>
205+
> Changing from `ignore_vpc = false` to `ignore_vpc = true`:
206+
>
207+
> ```bash
208+
>terraform state mv 'module.zone.aws_route53_zone.this[0]' 'module.zone.aws_route53_zone.ignore_vpc[0]'
209+
> ```
210+
>
211+
> Or using a state block:
212+
>
213+
>```hcl
214+
>moved {
215+
> from = module.zone.aws_route53_zone.this[0]
216+
> to = module.zone.aws_route53_zone.ignore_vpc[0]
217+
>}
218+
> ```
219+
>
220+
> Changing from `ignore_vpc = true` to `ignore_vpc = false`:
221+
>
222+
>```bash
223+
>terraform state mv 'module.zone.aws_route53_zone.ignore_vpc[0]' 'module.zone.aws_route53_zone.this[0]'
224+
> ```
225+
>
226+
> Or using a state block:
227+
>
228+
>```hcl
229+
>moved {
230+
> from = module.zone.aws_route53_zone.ignore_vpc[0]
231+
> to = module.zone.aws_route53_zone.this[0]
232+
>}
233+
> ```
234+
>
235+
200236
```hcl
201237
module "zone" {
202238
source = "terraform-aws-modules/route53/aws"

examples/cross-account/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,42 @@ Configuration in this directory creates:
1313
>
1414
> Hence why the `aws_route53_zone_association` resource is *outside* the scope of the module, but the authorization (`aws_route53_vpc_association_authorization`) is *inside* the scope of the module.
1515
16+
> [!CAUTION]
17+
> Since Terraform does not support variables in the `lifecycle_block`, the `ignore_vpc` variable is used to switch between two resources: `aws_route53_zone.this` and `aws_route53_zone.ignore_vpc`.
18+
> Therefore, if you changes this value after resources have been created, Terraform will attempt to destroy and recreate the Route53 zone which is usually not desired. To avoid this,
19+
> you will need to perform the appropriate state move commands/blocks between the two resources.
20+
>
21+
> Changing from `ignore_vpc = false` to `ignore_vpc = true`:
22+
>
23+
> ```bash
24+
>terraform state mv 'module.zone.aws_route53_zone.this[0]' 'module.zone.aws_route53_zone.ignore_vpc[0]'
25+
> ```
26+
>
27+
> Or using a state block:
28+
>
29+
>```hcl
30+
>moved {
31+
> from = module.zone.aws_route53_zone.this[0]
32+
> to = module.zone.aws_route53_zone.ignore_vpc[0]
33+
>}
34+
> ```
35+
>
36+
> Changing from `ignore_vpc = true` to `ignore_vpc = false`:
37+
>
38+
>```bash
39+
>terraform state mv 'module.zone.aws_route53_zone.ignore_vpc[0]' 'module.zone.aws_route53_zone.this[0]'
40+
> ```
41+
>
42+
> Or using a state block:
43+
>
44+
>```hcl
45+
>moved {
46+
> from = module.zone.aws_route53_zone.ignore_vpc[0]
47+
> to = module.zone.aws_route53_zone.this[0]
48+
>}
49+
> ```
50+
>
51+
1652
## Usage
1753
1854
To run this example you need to execute:

0 commit comments

Comments
 (0)