I'm looking to manage an existing RDS instance using a module.
Fetching the data through the module seemed initially fine, but when attempting to maintain the resources, it appeared that the ARN, endpoint, and address were being altered during Terraform planning.
As we're keen to avoid changes to the endpoint from the development side, I attempted to retrieve this information as output variables of the module within the root module's main.tf file. However, this approach seems to be resulting in a circular reference.
Could you please provide guidance on how to resolve this issue?
.
├── main.tf
└── modules
└── aws_rds
├── rds_instance.tf
├── output.tf
└── variables.tf
In the rds_instance.tf file, I inserted:
data "aws_db_instance" "example" {
db_instance_identifier = var.identifier
}
to retrieve:
output "rds_arn" {
value = data.aws_db_instance.example.arn
}
I'm currently trying to proceed with this change to fetch the arn, but encountering a red underline on the arn part.
You probably want db_instance_arn
, i.e:
output "rds_arn" {
value = data.aws_db_instance.example.db_instance_arn
}