I have this resource being created by terraform. How can I reference the arn in the next resource creation?
resource "aws_cloudformation_stack" "datadog_forwarder" {
name = "datadog-forwarder"
capabilities = ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
parameters = {
DdApiKeySecretArn = "secret_arn",
DdSite = "datadoghq.com",
FunctionName = "datadog-forwarder"
DdTags = "env:dev"
}
template_url = "https://datadog-cloudformation-template.s3.amazonaws.com/aws/forwarder/latest.yaml"
}
I need it referenced here:
resource "aws_cloudwatch_log_subscription_filter" "datadog_log_subscription_navblue-dd-agent" {
name = "datadog_log_subscription_filter"
log_group_name = "/"
destination_arn = ARN_GOES_HERE
filter_pattern = ""
}
CodePudding user response:
You have to use data source aws_cloudformation_stack to query the datadog stack that you just created. If you do that, you will find ARN in the output argument of the data source.