You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to move one resource to another place as part of a refactor. This could be related to modules and submodules along with lists of resources.
Terraform plan shows that one resource will be deleted and another one like it will be created, however the state move fails because the new one does not exist yet. I have successfully renamed things in the past without this issue.
terraform plan
...
# module.backend_service.aws_route53_record.dns[0] will be destroyed
- resource "aws_route53_record" "dns" {
- fqdn = "my.dns" -> null
- id = "AAAAAAAAAAAAAA_backend_A" -> null
- name = "backend" -> null
- records = [] -> null
- ttl = 0 -> null
- type = "A" -> null
- zone_id = "AAAAAAAAAAAAAA" -> null
- alias {
- evaluate_target_health = true -> null
- name = "my.load.balancer" -> null
- zone_id = "BBBBBBBBBBBBB" -> null
}
}
# module.backend_service.module.dns.aws_route53_record.ipv4[0] will be created
+ resource "aws_route53_record" "ipv4" {
+ allow_overwrite = (known after apply)
+ fqdn = (known after apply)
+ id = (known after apply)
+ name = "backend"
+ type = "A"
+ zone_id = "AAAAAAAAAAAAAA"
+ alias {
+ evaluate_target_health = true
+ name = "my.load.balancer"
+ zone_id = "BBBBBBBBBBBBB"
}
}
terraform state mv module.backend_service.aws_route53_record.dns[0] module.backend_service.module.dns.aws_route53_record.ipv4[0]
Error: Invalid target address
Cannot move to module.backend_service.module.dns.aws_route53_record.ipv4[0]:
module.backend_service.module.dns does not exist in the current state.
# should should be using modules/lb_dns_record# this is an intrusive change which will be made laterresourceaws_route53_recorddns {
count=var.create_load_balancer?length(var.dns_zones.external_zones) :0zone_id=var.dns_zones.external_zones[count.index].zone_idname=var.nametype="A"alias {
name=aws_lb.lb[0].dns_namezone_id=aws_lb.lb[0].zone_idevaluate_target_health=true
}
}
resourceaws_route53_recordipv6_dns {
count=var.create_load_balancer?length(var.dns_zones.external_zones) :0zone_id=var.dns_zones.external_zones[count.index].zone_idname=var.nametype="AAAA"alias {
name=aws_lb.lb[0].dns_namezone_id=aws_lb.lb[0].zone_idevaluate_target_health=true
}
}
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
ghost
locked and limited conversation to collaborators
Sep 2, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am unable to move one resource to another place as part of a refactor. This could be related to modules and submodules along with lists of resources.
Terraform plan shows that one resource will be deleted and another one like it will be created, however the state move fails because the new one does not exist yet. I have successfully renamed things in the past without this issue.
Terraform Version
Terraform Configuration Files
OLD modules/container/dns.tf
NEW modules/container/dns.tf
modules/lb_dns_record/main.tf
Expected Behavior
The state mv should be successful so that the resource does not need to be destroyed and recreated.
Actual Behavior
The state mv command fails with
module.backend_service.module.dns does not exist in the current state.
Steps to Reproduce
terraform init
terraform plan
terraform state mv module.backend_service.aws_route53_record.dns[0] module.backend_service.module.dns.aws_route53_record.ipv4[0]
The text was updated successfully, but these errors were encountered: