2
votes

From my Terraform script, I am trying to get hold of data for existing resources such as the ARN of an existing DynamoDB table and the bucket Id for an exiting S3 bucket. I've tried to use terraform_remote_state for S3, however it doesn't fit my requirements as it requires a key and I haven't found anything yet that would work for Dynamo.

Is there a solution the would work for both or would there be two separate solutions?

Many thanks in advance.

1

1 Answers

4
votes

Remote state is not the concept you need - that's for storage of the tfstate file. What you require is a "data source":

In Terraform, you use "Resources" to declare what things need to be created (if they don't exist), and "Data Sources" to read information from things that already exist and are not managed by Terraform.