AWS AppSync Function

This page shows how to write Terraform and CloudFormation for AWS AppSync Function and write them securely.

aws_appsync_function (Terraform)

The Function in AWS AppSync can be configured in Terraform with the resource name aws_appsync_function. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub
resource "aws_appsync_function" "get_game_function" {
  api_id                    =
  data_source               =
  name                      = "get_cart_function"
  request_mapping_template  = file("./AppSync/functions/getGame/request-mapping.vtl")
  response_mapping_template = file("./AppSync/resolvers/_generic/generic-response-mapping-item-SINGULAR.vtl")
resource "aws_appsync_function" "get_user_function" {
  api_id                    =
  data_source               =
  name                      = "get_user_function"
  request_mapping_template  = file("./AppSync/functions/getUser/request-mapping.vtl")
  response_mapping_template = file("./AppSync/resolvers/_generic/generic-response-mapping-items-NULL-OR-FIRST.vtl")
resource "aws_appsync_function" "function" {
  count                     = length(var.function)
  api_id                    = element(var.api_id, lookup(var.function[count.index], "api_id"))
  data_source               = element(var.data_source, lookup(var.function[count.index], "datasource_id"))
  name                      = lookup(var.function[count.index], "name")
  description               = lookup(var.function[count.index], "description")
resource "aws_appsync_function" "this" {
  api_id                    = var.api_id
  data_source               = var.data_source
  description               = var.description
  function_version          = var.function_version
  name                      =

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


Explanation in Terraform Registry

Provides an AppSync Function.

AWS::AppSync::FunctionConfiguration (CloudFormation)

The FunctionConfiguration in AppSync can be configured in CloudFormation with the resource name AWS::AppSync::FunctionConfiguration. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.


Explanation in CloudFormation Registry

The AWS::AppSync::FunctionConfiguration resource defines the functions in GraphQL APIs to perform certain operations. You can use pipeline resolvers to attach functions. For more information, see Pipeline Resolvers in the AWS AppSync Developer Guide. Note When you submit an update, AWS CloudFormation updates resources based on differences between what you submit and the stack's current template. To cause this resource to be updated you must change a property value for this resource in the AWS CloudFormation template. Changing the Amazon S3 file content without changing a property value will not result in an update operation. See Update Behaviors of Stack Resources in the AWS CloudFormation User Guide.

Frequently asked questions

What is AWS AppSync Function?

AWS AppSync Function is a resource for AppSync of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS AppSync Function?

For Terraform, the charlieargue/rate-test-karlgolka, charlieargue/multi-cart and mikamakusa/terraform source code examples are useful. See the Terraform Example section for further details.