如何获得新创建的aws_cloudformation_stack地形的arn



我有这个资源是由terraform创建的。如何在下次创建资源时引用arn?

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"
}

我需要在这里引用它:

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  = ""
}
data "aws_cloudformation_stack" "datadog-cf-arn" {
name = "datadog-forwarder"
}
resource "aws_cloudwatch_log_subscription_filter" "datadog_log_subscription_navblue-dd-agent" {
name            = "datadog_log_subscription_filter"
log_group_name  = "/"
destination_arn = data.aws_cloudformation_stack.datadog-cf-arn.id
filter_pattern  = ""
}

这就是如何使用数据来获取CloudFormation arn。希望这能帮助你解决问题。

您必须使用数据源aws_cloudformation_stack来查询刚刚创建的数据狗堆栈。如果您这样做,您将在数据源的输出参数中找到ARN。

相关内容

  • 没有找到相关文章

最新更新