UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

542 lines (541 loc) • 20.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Provides an Amplify App resource, a fullstack serverless app hosted on the [AWS Amplify Console](https://docs.aws.amazon.com/amplify/latest/userguide/welcome.html). * * > **Note:** When you create/update an Amplify App from the provider, you may end up with the error "BadRequestException: You should at least provide one valid token" because of authentication issues. See the section "Repository with Tokens" below. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.amplify.App("example", { * name: "example", * repository: "https://github.com/example/app", * buildSpec: `version: 0.1 * frontend: * phases: * preBuild: * commands: * - yarn install * build: * commands: * - yarn run build * artifacts: * baseDirectory: build * files: * - '**&#47;*' * cache: * paths: * - node_modules/**&#47;* * `, * customRules: [{ * source: "/<*>", * status: "404", * target: "/index.html", * }], * environmentVariables: { * ENV: "test", * }, * }); * ``` * * ### Repository with Tokens * * If you create a new Amplify App with the `repository` argument, you also need to set `oauthToken` or `accessToken` for authentication. For GitHub, get a [personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) and set `accessToken` as follows: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.amplify.App("example", { * name: "example", * repository: "https://github.com/example/app", * accessToken: "...", * }); * ``` * * You can omit `accessToken` if you import an existing Amplify App created by the Amplify Console (using OAuth for authentication). * * ### Auto Branch Creation * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.amplify.App("example", { * name: "example", * enableAutoBranchCreation: true, * autoBranchCreationPatterns: [ * "*", * "*&#47;**", * ], * autoBranchCreationConfig: { * enableAutoBuild: true, * }, * }); * ``` * * ### Basic Authorization * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as std from "@pulumi/std"; * * const example = new aws.amplify.App("example", { * name: "example", * enableBasicAuth: true, * basicAuthCredentials: std.base64encode({ * input: "username1:password1", * }).then(invoke => invoke.result), * }); * ``` * * ### Rewrites and Redirects * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.amplify.App("example", { * name: "example", * customRules: [ * { * source: "/api/<*>", * status: "200", * target: "https://api.example.com/api/<*>", * }, * { * source: "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>", * status: "200", * target: "/index.html", * }, * ], * }); * ``` * * ### Custom Image * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.amplify.App("example", { * name: "example", * environmentVariables: { * _CUSTOM_IMAGE: "node:16", * }, * }); * ``` * * ### Custom Headers * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.amplify.App("example", { * name: "example", * customHeaders: `customHeaders: * - pattern: '**' * headers: * - key: 'Strict-Transport-Security' * value: 'max-age=31536000; includeSubDomains' * - key: 'X-Frame-Options' * value: 'SAMEORIGIN' * - key: 'X-XSS-Protection' * value: '1; mode=block' * - key: 'X-Content-Type-Options' * value: 'nosniff' * - key: 'Content-Security-Policy' * value: "default-src 'self'" * `, * }); * ``` * * ### Job Config * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.amplify.App("example", { * name: "example", * jobConfig: { * buildComputeType: "STANDARD_8GB", * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Amplify App using Amplify App ID (appId). For example: * * ```sh * $ pulumi import aws:amplify/app:App example d2ypk4k47z8u6 * ``` * App ID can be obtained from App ARN (e.g., `arn:aws:amplify:us-east-1:12345678:apps/d2ypk4k47z8u6`). */ export declare class App extends pulumi.CustomResource { /** * Get an existing App resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AppState, opts?: pulumi.CustomResourceOptions): App; /** * Returns true if the given object is an instance of App. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is App; /** * Personal access token for a third-party source control system for an Amplify app. This token must have write access to the relevant repo to create a webhook and a read-only deploy key for the Amplify project. The token is not stored, so after applying this attribute can be removed and the setup token deleted. */ readonly accessToken: pulumi.Output<string | undefined>; /** * ARN of the Amplify app. */ readonly arn: pulumi.Output<string>; /** * Automated branch creation configuration for an Amplify app. See `autoBranchCreationConfig` Block for details. */ readonly autoBranchCreationConfig: pulumi.Output<outputs.amplify.AppAutoBranchCreationConfig>; /** * Automated branch creation glob patterns for an Amplify app. */ readonly autoBranchCreationPatterns: pulumi.Output<string[] | undefined>; /** * Credentials for basic authorization for an Amplify app. */ readonly basicAuthCredentials: pulumi.Output<string | undefined>; /** * The [build specification](https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html) (build spec) for an Amplify app. */ readonly buildSpec: pulumi.Output<string>; /** * Cache configuration for the Amplify app. See `cacheConfig` Block for details. */ readonly cacheConfig: pulumi.Output<outputs.amplify.AppCacheConfig>; /** * AWS Identity and Access Management (IAM) SSR compute role for an Amplify app. */ readonly computeRoleArn: pulumi.Output<string | undefined>; /** * The [custom HTTP headers](https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html) for an Amplify app. */ readonly customHeaders: pulumi.Output<string>; /** * Custom rewrite and redirect rules for an Amplify app. See `customRule` Block for details. */ readonly customRules: pulumi.Output<outputs.amplify.AppCustomRule[] | undefined>; /** * Default domain for the Amplify app. */ readonly defaultDomain: pulumi.Output<string>; /** * Description for an Amplify app. */ readonly description: pulumi.Output<string | undefined>; /** * Enables automated branch creation for an Amplify app. */ readonly enableAutoBranchCreation: pulumi.Output<boolean | undefined>; /** * Enables basic authorization for an Amplify app. This will apply to all branches that are part of this app. */ readonly enableBasicAuth: pulumi.Output<boolean | undefined>; /** * Enables auto-building of branches for the Amplify App. */ readonly enableBranchAutoBuild: pulumi.Output<boolean | undefined>; /** * Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository. */ readonly enableBranchAutoDeletion: pulumi.Output<boolean | undefined>; /** * Environment variables map for an Amplify app. */ readonly environmentVariables: pulumi.Output<{ [key: string]: string; } | undefined>; /** * AWS Identity and Access Management (IAM) service role for an Amplify app. */ readonly iamServiceRoleArn: pulumi.Output<string | undefined>; /** * Used to configure the [Amplify Application build instance compute type](https://docs.aws.amazon.com/amplify/latest/APIReference/API_JobConfig.html#amplify-Type-JobConfig-buildComputeType). See `jobConfig` Block for details. */ readonly jobConfig: pulumi.Output<outputs.amplify.AppJobConfig>; /** * Name for an Amplify app. */ readonly name: pulumi.Output<string>; /** * OAuth token for a third-party source control system for an Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored. */ readonly oauthToken: pulumi.Output<string | undefined>; /** * Platform or framework for an Amplify app. Valid values: `WEB`, `WEB_COMPUTE`. Default value: `WEB`. */ readonly platform: pulumi.Output<string | undefined>; /** * Describes the information about a production branch for an Amplify app. A `productionBranch` block is documented below. */ readonly productionBranches: pulumi.Output<outputs.amplify.AppProductionBranch[]>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Repository for an Amplify app. */ readonly repository: pulumi.Output<string | undefined>; /** * Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ readonly tagsAll: pulumi.Output<{ [key: string]: string; }>; /** * Create a App resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: AppArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering App resources. */ export interface AppState { /** * Personal access token for a third-party source control system for an Amplify app. This token must have write access to the relevant repo to create a webhook and a read-only deploy key for the Amplify project. The token is not stored, so after applying this attribute can be removed and the setup token deleted. */ accessToken?: pulumi.Input<string>; /** * ARN of the Amplify app. */ arn?: pulumi.Input<string>; /** * Automated branch creation configuration for an Amplify app. See `autoBranchCreationConfig` Block for details. */ autoBranchCreationConfig?: pulumi.Input<inputs.amplify.AppAutoBranchCreationConfig>; /** * Automated branch creation glob patterns for an Amplify app. */ autoBranchCreationPatterns?: pulumi.Input<pulumi.Input<string>[]>; /** * Credentials for basic authorization for an Amplify app. */ basicAuthCredentials?: pulumi.Input<string>; /** * The [build specification](https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html) (build spec) for an Amplify app. */ buildSpec?: pulumi.Input<string>; /** * Cache configuration for the Amplify app. See `cacheConfig` Block for details. */ cacheConfig?: pulumi.Input<inputs.amplify.AppCacheConfig>; /** * AWS Identity and Access Management (IAM) SSR compute role for an Amplify app. */ computeRoleArn?: pulumi.Input<string>; /** * The [custom HTTP headers](https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html) for an Amplify app. */ customHeaders?: pulumi.Input<string>; /** * Custom rewrite and redirect rules for an Amplify app. See `customRule` Block for details. */ customRules?: pulumi.Input<pulumi.Input<inputs.amplify.AppCustomRule>[]>; /** * Default domain for the Amplify app. */ defaultDomain?: pulumi.Input<string>; /** * Description for an Amplify app. */ description?: pulumi.Input<string>; /** * Enables automated branch creation for an Amplify app. */ enableAutoBranchCreation?: pulumi.Input<boolean>; /** * Enables basic authorization for an Amplify app. This will apply to all branches that are part of this app. */ enableBasicAuth?: pulumi.Input<boolean>; /** * Enables auto-building of branches for the Amplify App. */ enableBranchAutoBuild?: pulumi.Input<boolean>; /** * Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository. */ enableBranchAutoDeletion?: pulumi.Input<boolean>; /** * Environment variables map for an Amplify app. */ environmentVariables?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * AWS Identity and Access Management (IAM) service role for an Amplify app. */ iamServiceRoleArn?: pulumi.Input<string>; /** * Used to configure the [Amplify Application build instance compute type](https://docs.aws.amazon.com/amplify/latest/APIReference/API_JobConfig.html#amplify-Type-JobConfig-buildComputeType). See `jobConfig` Block for details. */ jobConfig?: pulumi.Input<inputs.amplify.AppJobConfig>; /** * Name for an Amplify app. */ name?: pulumi.Input<string>; /** * OAuth token for a third-party source control system for an Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored. */ oauthToken?: pulumi.Input<string>; /** * Platform or framework for an Amplify app. Valid values: `WEB`, `WEB_COMPUTE`. Default value: `WEB`. */ platform?: pulumi.Input<string>; /** * Describes the information about a production branch for an Amplify app. A `productionBranch` block is documented below. */ productionBranches?: pulumi.Input<pulumi.Input<inputs.amplify.AppProductionBranch>[]>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Repository for an Amplify app. */ repository?: pulumi.Input<string>; /** * Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ tagsAll?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; } /** * The set of arguments for constructing a App resource. */ export interface AppArgs { /** * Personal access token for a third-party source control system for an Amplify app. This token must have write access to the relevant repo to create a webhook and a read-only deploy key for the Amplify project. The token is not stored, so after applying this attribute can be removed and the setup token deleted. */ accessToken?: pulumi.Input<string>; /** * Automated branch creation configuration for an Amplify app. See `autoBranchCreationConfig` Block for details. */ autoBranchCreationConfig?: pulumi.Input<inputs.amplify.AppAutoBranchCreationConfig>; /** * Automated branch creation glob patterns for an Amplify app. */ autoBranchCreationPatterns?: pulumi.Input<pulumi.Input<string>[]>; /** * Credentials for basic authorization for an Amplify app. */ basicAuthCredentials?: pulumi.Input<string>; /** * The [build specification](https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html) (build spec) for an Amplify app. */ buildSpec?: pulumi.Input<string>; /** * Cache configuration for the Amplify app. See `cacheConfig` Block for details. */ cacheConfig?: pulumi.Input<inputs.amplify.AppCacheConfig>; /** * AWS Identity and Access Management (IAM) SSR compute role for an Amplify app. */ computeRoleArn?: pulumi.Input<string>; /** * The [custom HTTP headers](https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html) for an Amplify app. */ customHeaders?: pulumi.Input<string>; /** * Custom rewrite and redirect rules for an Amplify app. See `customRule` Block for details. */ customRules?: pulumi.Input<pulumi.Input<inputs.amplify.AppCustomRule>[]>; /** * Description for an Amplify app. */ description?: pulumi.Input<string>; /** * Enables automated branch creation for an Amplify app. */ enableAutoBranchCreation?: pulumi.Input<boolean>; /** * Enables basic authorization for an Amplify app. This will apply to all branches that are part of this app. */ enableBasicAuth?: pulumi.Input<boolean>; /** * Enables auto-building of branches for the Amplify App. */ enableBranchAutoBuild?: pulumi.Input<boolean>; /** * Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository. */ enableBranchAutoDeletion?: pulumi.Input<boolean>; /** * Environment variables map for an Amplify app. */ environmentVariables?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * AWS Identity and Access Management (IAM) service role for an Amplify app. */ iamServiceRoleArn?: pulumi.Input<string>; /** * Used to configure the [Amplify Application build instance compute type](https://docs.aws.amazon.com/amplify/latest/APIReference/API_JobConfig.html#amplify-Type-JobConfig-buildComputeType). See `jobConfig` Block for details. */ jobConfig?: pulumi.Input<inputs.amplify.AppJobConfig>; /** * Name for an Amplify app. */ name?: pulumi.Input<string>; /** * OAuth token for a third-party source control system for an Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored. */ oauthToken?: pulumi.Input<string>; /** * Platform or framework for an Amplify app. Valid values: `WEB`, `WEB_COMPUTE`. Default value: `WEB`. */ platform?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Repository for an Amplify app. */ repository?: pulumi.Input<string>; /** * Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }