A `moved` block inside your module referencing a resource in a registry module fails with `Cross-package move statement`.
AdvancedTroubleshootingImport, Already Exists and State Surgery
Answer
Likely causes → moved can only refer to objects within your module package; you can't move into or out of a separately installed module's internals from inside it.
Diagnose → The error names the external package source.
Fix → Put the moved block in the calling module, using full module paths:
moved {
from = aws_vpc.main
to = module.vpc.aws_vpc.this[0]
}
Prevent → Do refactors that cross module boundaries in the root module, and look up the registry module's real resource names and instance keys first.
More on Import, Already Exists and State Surgery
Apply fails with `EntityAlreadyExists: Role with name app-role already exists.`Beginner`terraform apply` on a new bucket fails with `BucketAlreadyExists`. You have never created that bucket.Beginner`Error: Resource already managed by Terraform` when running `terraform import aws_s3_bucket.logs acme-logs`.Beginner`Error: Cannot import non-existent remote object` for a resource you can see in the console.Intermediate`Error: Configuration for import target does not exist` when running `terraform plan` with an `import` block.Beginner`terraform plan -generate-config-out=generated.tf` fails with `Conflicting configuration arguments` in the generated file.Intermediate