Module appsync

@pulumi/aws > appsync

class ApiKey

extends CustomResource

Provides an AppSync API Key.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleGraphQLApi = new aws.appsync.GraphQLApi("example", {
    authenticationType: "API_KEY",
});
const exampleApiKey = new aws.appsync.ApiKey("example", {
    apiId: exampleGraphQLApi.id,
    expires: "2018-05-03T04:00:00Z",
});

constructor

new ApiKey(name: string, args: ApiKeyArgs, opts?: pulumi.CustomResourceOptions)

Create a ApiKey resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ApiKeyState, opts?: pulumi.CustomResourceOptions): ApiKey

Get an existing ApiKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property apiId

public apiId: pulumi.Output<string>;

The ID of the associated AppSync API

property description

public description: pulumi.Output<string | undefined>;

The API key description. Defaults to “Managed by Terraform”.

property expires

public expires: pulumi.Output<string | undefined>;

RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property key

public key: pulumi.Output<string>;

The API key

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class DataSource

extends CustomResource

Provides an AppSync DataSource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleGraphQLApi = new aws.appsync.GraphQLApi("example", {
    authenticationType: "API_KEY",
});
const exampleTable = new aws.dynamodb.Table("example", {
    attributes: [{
        name: "UserId",
        type: "S",
    }],
    hashKey: "UserId",
    readCapacity: 1,
    writeCapacity: 1,
});
const exampleRole = new aws.iam.Role("example", {
    assumeRolePolicy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "appsync.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
`,
});
const exampleDataSource = new aws.appsync.DataSource("example", {
    apiId: exampleGraphQLApi.id,
    dynamodbConfig: {
        tableName: exampleTable.name,
    },
    serviceRoleArn: exampleRole.arn,
    type: "AMAZON_DYNAMODB",
});
const exampleRolePolicy = new aws.iam.RolePolicy("example", {
    policy: pulumi.interpolate`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "dynamodb:*"
      ],
      "Effect": "Allow",
      "Resource": [
        "${exampleTable.arn}"
      ]
    }
  ]
}
`,
    role: exampleRole.id,
});

constructor

new DataSource(name: string, args: DataSourceArgs, opts?: pulumi.CustomResourceOptions)

Create a DataSource resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DataSourceState, opts?: pulumi.CustomResourceOptions): DataSource

Get an existing DataSource resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property apiId

public apiId: pulumi.Output<string>;

The API ID for the GraphQL API for the DataSource.

property arn

public arn: pulumi.Output<string>;

The ARN

property description

public description: pulumi.Output<string | undefined>;

A description of the DataSource.

property dynamodbConfig

public dynamodbConfig: pulumi.Output<{
    region: string;
    tableName: string;
    useCallerCredentials: undefined | false | true;
} | undefined>;

DynamoDB settings. See below

property elasticsearchConfig

public elasticsearchConfig: pulumi.Output<{
    endpoint: string;
    region: string;
} | undefined>;

Amazon Elasticsearch settings. See below

property httpConfig

public httpConfig: pulumi.Output<{
    endpoint: string;
} | undefined>;

HTTP settings. See below

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property lambdaConfig

public lambdaConfig: pulumi.Output<{
    functionArn: string;
} | undefined>;

AWS Lambda settings. See below

property name

public name: pulumi.Output<string>;

A user-supplied name for the DataSource.

property serviceRoleArn

public serviceRoleArn: pulumi.Output<string | undefined>;

The IAM service role ARN for the data source.

property type

public type: pulumi.Output<string>;

The type of the DataSource. Valid values: AWS_LAMBDA, AMAZON_DYNAMODB, AMAZON_ELASTICSEARCH, HTTP, NONE.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class GraphQLApi

extends CustomResource

Provides an AppSync GraphQL API.

Example Usage

API Key Authentication

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appsync.GraphQLApi("example", {
    authenticationType: "API_KEY",
});

AWS Cognito User Pool Authentication

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appsync.GraphQLApi("example", {
    authenticationType: "AMAZON_COGNITO_USER_POOLS",
    userPoolConfig: {
        awsRegion: aws_region_current.name,
        defaultAction: "DENY",
        userPoolId: aws_cognito_user_pool_example.id,
    },
});

AWS IAM Authentication

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appsync.GraphQLApi("example", {
    authenticationType: "AWS_IAM",
});

With Schema

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appsync.GraphQLApi("example", {
    authenticationType: "AWS_IAM",
    schema: `schema {
	query: Query
}
type Query {
  test: Int
}
`,
});

OpenID Connect Authentication

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appsync.GraphQLApi("example", {
    authenticationType: "OPENID_CONNECT",
    openidConnectConfig: {
        issuer: "https://example.com",
    },
});

Enabling Logging

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleRole = new aws.iam.Role("example", {
    assumeRolePolicy: `{
    "Version": "2012-10-17",
    "Statement": [
        {
        "Effect": "Allow",
        "Principal": {
            "Service": "appsync.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
        }
    ]
}
`,
});
const exampleGraphQLApi = new aws.appsync.GraphQLApi("example", {
    logConfig: {
        cloudwatchLogsRoleArn: exampleRole.arn,
        fieldLogLevel: "ERROR",
    },
});
const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", {
    policyArn: "arn:aws:iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs",
    role: exampleRole.name,
});

constructor

new GraphQLApi(name: string, args: GraphQLApiArgs, opts?: pulumi.CustomResourceOptions)

Create a GraphQLApi resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: GraphQLApiState, opts?: pulumi.CustomResourceOptions): GraphQLApi

Get an existing GraphQLApi resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property arn

public arn: pulumi.Output<string>;

The ARN

property authenticationType

public authenticationType: pulumi.Output<string>;

The authentication type. Valid values: API_KEY, AWS_IAM, AMAZON_COGNITO_USER_POOLS, OPENID_CONNECT

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property logConfig

public logConfig: pulumi.Output<{
    cloudwatchLogsRoleArn: string;
    fieldLogLevel: string;
} | undefined>;

Nested argument containing logging configuration. Defined below.

property name

public name: pulumi.Output<string>;

A user-supplied name for the GraphqlApi.

property openidConnectConfig

public openidConnectConfig: pulumi.Output<{
    authTtl: undefined | number;
    clientId: undefined | string;
    iatTtl: undefined | number;
    issuer: string;
} | undefined>;

Nested argument containing OpenID Connect configuration. Defined below.

property schema

public schema: pulumi.Output<string | undefined>;

The schema definition, in GraphQL schema language format. Terraform cannot perform drift detection of this configuration.

property tags

public tags: pulumi.Output<{[key: string]: any} | undefined>;

A mapping of tags to assign to the resource.

property uris

public uris: pulumi.Output<{[key: string]: string}>;

Map of URIs associated with the API. e.g. uris["GRAPHQL"] = https://ID.appsync-api.REGION.amazonaws.com/graphql

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

property userPoolConfig

public userPoolConfig: pulumi.Output<{
    appIdClientRegex: undefined | string;
    awsRegion: string;
    defaultAction: string;
    userPoolId: string;
} | undefined>;

The Amazon Cognito User Pool configuration. Defined below.

class Resolver

extends CustomResource

Provides an AppSync Resolver.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testGraphQLApi = new aws.appsync.GraphQLApi("test", {
    authenticationType: "API_KEY",
    schema: `type Mutation {
	putPost(id: ID!, title: String!): Post
}

type Post {
	id: ID!
	title: String!
}

type Query {
	singlePost(id: ID!): Post
}

schema {
	query: Query
	mutation: Mutation
}
`,
});
const testDataSource = new aws.appsync.DataSource("test", {
    apiId: testGraphQLApi.id,
    httpConfig: {
        endpoint: "http://example.com",
    },
    type: "HTTP",
});
const testResolver = new aws.appsync.Resolver("test", {
    apiId: testGraphQLApi.id,
    dataSource: testDataSource.name,
    field: "singlePost",
    requestTemplate: `{
    "version": "2018-05-29",
    "method": "GET",
    "resourcePath": "/",
    "params":{
        "headers": $utils.http.copyheaders($ctx.request.headers)
    }
}
`,
    responseTemplate: `#if($ctx.result.statusCode == 200)
    $ctx.result.body
#else
    $utils.appendError($ctx.result.body, $ctx.result.statusCode)
#end
`,
    type: "Query",
});

constructor

new Resolver(name: string, args: ResolverArgs, opts?: pulumi.CustomResourceOptions)

Create a Resolver resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ResolverState, opts?: pulumi.CustomResourceOptions): Resolver

Get an existing Resolver resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property apiId

public apiId: pulumi.Output<string>;

The API ID for the GraphQL API.

property arn

public arn: pulumi.Output<string>;

The ARN

property dataSource

public dataSource: pulumi.Output<string>;

The DataSource name.

property field

public field: pulumi.Output<string>;

The field name from the schema defined in the GraphQL API.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property requestTemplate

public requestTemplate: pulumi.Output<string>;

The request mapping template for this resolver.

property responseTemplate

public responseTemplate: pulumi.Output<string>;

The response mapping template for this resolver.

property type

public type: pulumi.Output<string>;

The type name from the schema defined in the GraphQL API.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

interface ApiKeyArgs

The set of arguments for constructing a ApiKey resource.

property apiId

apiId: pulumi.Input<string>;

The ID of the associated AppSync API

property description

description?: pulumi.Input<string>;

The API key description. Defaults to “Managed by Terraform”.

property expires

expires?: pulumi.Input<string>;

RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.

interface ApiKeyState

Input properties used for looking up and filtering ApiKey resources.

property apiId

apiId?: pulumi.Input<string>;

The ID of the associated AppSync API

property description

description?: pulumi.Input<string>;

The API key description. Defaults to “Managed by Terraform”.

property expires

expires?: pulumi.Input<string>;

RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.

property key

key?: pulumi.Input<string>;

The API key

interface DataSourceArgs

The set of arguments for constructing a DataSource resource.

property apiId

apiId: pulumi.Input<string>;

The API ID for the GraphQL API for the DataSource.

property description

description?: pulumi.Input<string>;

A description of the DataSource.

property dynamodbConfig

dynamodbConfig?: pulumi.Input<{
    region: pulumi.Input<string>;
    tableName: pulumi.Input<string>;
    useCallerCredentials: pulumi.Input<boolean>;
}>;

DynamoDB settings. See below

property elasticsearchConfig

elasticsearchConfig?: pulumi.Input<{
    endpoint: pulumi.Input<string>;
    region: pulumi.Input<string>;
}>;

Amazon Elasticsearch settings. See below

property httpConfig

httpConfig?: pulumi.Input<{
    endpoint: pulumi.Input<string>;
}>;

HTTP settings. See below

property lambdaConfig

lambdaConfig?: pulumi.Input<{
    functionArn: pulumi.Input<string>;
}>;

AWS Lambda settings. See below

property name

name?: pulumi.Input<string>;

A user-supplied name for the DataSource.

property serviceRoleArn

serviceRoleArn?: pulumi.Input<string>;

The IAM service role ARN for the data source.

property type

type: pulumi.Input<string>;

The type of the DataSource. Valid values: AWS_LAMBDA, AMAZON_DYNAMODB, AMAZON_ELASTICSEARCH, HTTP, NONE.

interface DataSourceState

Input properties used for looking up and filtering DataSource resources.

property apiId

apiId?: pulumi.Input<string>;

The API ID for the GraphQL API for the DataSource.

property arn

arn?: pulumi.Input<string>;

The ARN

property description

description?: pulumi.Input<string>;

A description of the DataSource.

property dynamodbConfig

dynamodbConfig?: pulumi.Input<{
    region: pulumi.Input<string>;
    tableName: pulumi.Input<string>;
    useCallerCredentials: pulumi.Input<boolean>;
}>;

DynamoDB settings. See below

property elasticsearchConfig

elasticsearchConfig?: pulumi.Input<{
    endpoint: pulumi.Input<string>;
    region: pulumi.Input<string>;
}>;

Amazon Elasticsearch settings. See below

property httpConfig

httpConfig?: pulumi.Input<{
    endpoint: pulumi.Input<string>;
}>;

HTTP settings. See below

property lambdaConfig

lambdaConfig?: pulumi.Input<{
    functionArn: pulumi.Input<string>;
}>;

AWS Lambda settings. See below

property name

name?: pulumi.Input<string>;

A user-supplied name for the DataSource.

property serviceRoleArn

serviceRoleArn?: pulumi.Input<string>;

The IAM service role ARN for the data source.

property type

type?: pulumi.Input<string>;

The type of the DataSource. Valid values: AWS_LAMBDA, AMAZON_DYNAMODB, AMAZON_ELASTICSEARCH, HTTP, NONE.

interface GraphQLApiArgs

The set of arguments for constructing a GraphQLApi resource.

property authenticationType

authenticationType: pulumi.Input<string>;

The authentication type. Valid values: API_KEY, AWS_IAM, AMAZON_COGNITO_USER_POOLS, OPENID_CONNECT

property logConfig

logConfig?: pulumi.Input<{
    cloudwatchLogsRoleArn: pulumi.Input<string>;
    fieldLogLevel: pulumi.Input<string>;
}>;

Nested argument containing logging configuration. Defined below.

property name

name?: pulumi.Input<string>;

A user-supplied name for the GraphqlApi.

property openidConnectConfig

openidConnectConfig?: pulumi.Input<{
    authTtl: pulumi.Input<number>;
    clientId: pulumi.Input<string>;
    iatTtl: pulumi.Input<number>;
    issuer: pulumi.Input<string>;
}>;

Nested argument containing OpenID Connect configuration. Defined below.

property schema

schema?: pulumi.Input<string>;

The schema definition, in GraphQL schema language format. Terraform cannot perform drift detection of this configuration.

property tags

tags?: pulumi.Input<{[key: string]: any}>;

A mapping of tags to assign to the resource.

property userPoolConfig

userPoolConfig?: pulumi.Input<{
    appIdClientRegex: pulumi.Input<string>;
    awsRegion: pulumi.Input<string>;
    defaultAction: pulumi.Input<string>;
    userPoolId: pulumi.Input<string>;
}>;

The Amazon Cognito User Pool configuration. Defined below.

interface GraphQLApiState

Input properties used for looking up and filtering GraphQLApi resources.

property arn

arn?: pulumi.Input<string>;

The ARN

property authenticationType

authenticationType?: pulumi.Input<string>;

The authentication type. Valid values: API_KEY, AWS_IAM, AMAZON_COGNITO_USER_POOLS, OPENID_CONNECT

property logConfig

logConfig?: pulumi.Input<{
    cloudwatchLogsRoleArn: pulumi.Input<string>;
    fieldLogLevel: pulumi.Input<string>;
}>;

Nested argument containing logging configuration. Defined below.

property name

name?: pulumi.Input<string>;

A user-supplied name for the GraphqlApi.

property openidConnectConfig

openidConnectConfig?: pulumi.Input<{
    authTtl: pulumi.Input<number>;
    clientId: pulumi.Input<string>;
    iatTtl: pulumi.Input<number>;
    issuer: pulumi.Input<string>;
}>;

Nested argument containing OpenID Connect configuration. Defined below.

property schema

schema?: pulumi.Input<string>;

The schema definition, in GraphQL schema language format. Terraform cannot perform drift detection of this configuration.

property tags

tags?: pulumi.Input<{[key: string]: any}>;

A mapping of tags to assign to the resource.

property uris

uris?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;

Map of URIs associated with the API. e.g. uris["GRAPHQL"] = https://ID.appsync-api.REGION.amazonaws.com/graphql

property userPoolConfig

userPoolConfig?: pulumi.Input<{
    appIdClientRegex: pulumi.Input<string>;
    awsRegion: pulumi.Input<string>;
    defaultAction: pulumi.Input<string>;
    userPoolId: pulumi.Input<string>;
}>;

The Amazon Cognito User Pool configuration. Defined below.

interface ResolverArgs

The set of arguments for constructing a Resolver resource.

property apiId

apiId: pulumi.Input<string>;

The API ID for the GraphQL API.

property dataSource

dataSource: pulumi.Input<string>;

The DataSource name.

property field

field: pulumi.Input<string>;

The field name from the schema defined in the GraphQL API.

property requestTemplate

requestTemplate: pulumi.Input<string>;

The request mapping template for this resolver.

property responseTemplate

responseTemplate: pulumi.Input<string>;

The response mapping template for this resolver.

property type

type: pulumi.Input<string>;

The type name from the schema defined in the GraphQL API.

interface ResolverState

Input properties used for looking up and filtering Resolver resources.

property apiId

apiId?: pulumi.Input<string>;

The API ID for the GraphQL API.

property arn

arn?: pulumi.Input<string>;

The ARN

property dataSource

dataSource?: pulumi.Input<string>;

The DataSource name.

property field

field?: pulumi.Input<string>;

The field name from the schema defined in the GraphQL API.

property requestTemplate

requestTemplate?: pulumi.Input<string>;

The request mapping template for this resolver.

property responseTemplate

responseTemplate?: pulumi.Input<string>;

The response mapping template for this resolver.

property type

type?: pulumi.Input<string>;

The type name from the schema defined in the GraphQL API.