0

I'm trying to use a Lambda authoriser with the AppSync module for Terraform.

Here's my current terraform

module "appsync" {
  source = "terraform-aws-modules/appsync/aws"

  name = "api-appsync-${var.region}-${var.stage_name}"

  schema = file("modules/appsync/schema.graphql")

  api_keys = {
    default = null # such key will expire in 7 days
  }

  additional_authentication_provider = {
    iam = {
      authentication_type = "AWS_IAM"
    }
  }
  ...
}

I have the lambda authoriser working but currently have to update the AppSync settings manually after each deployment.

Kieran Crown
  • 307
  • 5
  • 16

1 Answers1

0

It should be available on terraform-provider-aws v3.70.0.

Here's the PR.

Waiting for that, you can use:

aws appsync update-graphql-api \
            --no-cli-auto-prompt \
            --name "$PROJECT_NAME" \
            --api-id "$APPSYNC_ID" \
            --authentication-type "AWS_LAMBDA" \
            --lambda-authorizer-config "{ \"authorizerResultTtlInSeconds\": 300, \"authorizerUri\": \"$LAMBDA_AUTH_APPSYNC_ARN\" }"
β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
  • I see this PR is merged now. Awesome! Thank you @Pharb ! A new release version has not yet been tagged though. I am still getting the Error: Unsupported argument when using the lambda_authorizer_config argument with version 3.69. How can I get the latest version of code which will include this PR. Here is my versions.tf file ```terraform { required_version = ">= 0.13" required_providers { aws = { source = "hashicorp/aws" version = "~> 3.69" } } }``` – Jaf Dec 15 '21 at 21:18