【发布时间】:2021-12-11 14:28:19
【问题描述】:
下面是我在从aws_appsync_function.appsync_functions 捕获function_id 并引用创建aws_appsync_resolver 的代码
#---- Create AppSync Functions -----
resource "aws_appsync_function" "appsync_functions" {
for_each = var.appsync_function
name = each.value.name
api_id = aws_appsync_graphql_api.appsync.id
data_source = each.value.data_source
request_mapping_template = file(each.value.request_template_path)
response_mapping_template = file(each.value.response_template_path)
description = each.value.description
}
#---- Create AppSync Resolvers -----
resource "aws_appsync_resolver" "appsync_pipeline_resolver" {
type = "Query"
api_id = aws_appsync_graphql_api.appsync.id
field = var.appsync_resolver.trailheadItemById.name
request_template = file(var.appsync_resolver.trailheadItemById.request_template_path)
response_template = file(var.appsync_resolver.trailheadItemById.response_template_path)
kind = "PIPELINE"
for_each = var.appsync_function
pipeline_config {
functions = aws_appsync_function.appsync_functions[each.key].name==var.appsync_resolver.trailheadItemById.name ? aws_appsync_function.appsync_functions["trailheadItemById"].function_id : ""
}
}
上面的代码捕获了我放置在 pipeline_config 下的所有 function_id 和条件,但无法正常工作!我可以获得语法方面的帮助来完成这项工作吗?
谢谢。
【问题讨论】:
-
你想在哪里引用function_id,即
aws_appsync_resolver的哪个参数? -
“不工作!” - 不具体。到底发生了什么?有任何错误消息吗?
标签: amazon-web-services terraform terraform-provider-aws aws-appsync aws-appsync-resolver