You should not use a data source to refer to a resource in the same config. It’s a chicken and egg thing, you can’t refer to something before it exists.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Security group rule resource is getting recreated with each TF apply | 8 | 8918 | March 29, 2022 | |
| Terraform OpenStack provider: Attaching security groups to instances on first deployment | 7 | 2114 | March 6, 2023 | |
| How to attach 1st SG to 1st instance and 2nd SG to 2nd Instance | 4 | 652 | July 22, 2021 | |
| Issue creating AWS VPC Security Group within defined VPC | 16 | 2136 | April 30, 2024 | |
| Using the imported resources to create new ones | 10 | 1409 | March 13, 2023 |