Below is the code I have where am stuck in capturing function_id
from aws_appsync_function.appsync_functions
and reference to create 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 : ""
}
}
Above code capturing all the function_id's and conditions I placed under pipeline_config not working! Can I get help with syntax to get this work?
Thankyou.