Skip to content

Importing a resource doesn't work if the module is calling other modules via for_each #30706

@applike-ss

Description

@applike-ss

Terraform Version

1.1.7

Terraform Configuration Files

https://github.com/applike-ss/tf-import-issue

Debug Output

https://gist.github.com/applike-ss/060f787190d29b707c06a0efccecdaa4

Expected Behavior

resource should be importable, because the for_each does not matter for the resource

Actual Behavior

resource was prepared to import, but import failed with Invalid for_each argument and data.null_data_source.f will be known only after apply

Steps to Reproduce

  • check out repo
  • have an aws account (or exchange the resource against anything else that can be imported that you have an account for)
  • terraform init
  • terraform import 'module.m[0].aws_sns_topic.t' arn:aws:sns:eu-central-1:123456789012:my-topic

Additional Context

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfigconfirmeda Terraform Core team member has reproduced this issuecore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions