@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
282 lines • 11.9 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.App = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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:
* - '**/*'
* cache:
* paths:
* - node_modules/**/*
* `,
* 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: [
* "*",
* "*/**",
* ],
* 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`).
*/
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, id, state, opts) {
return new App(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === App.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessToken"] = state ? state.accessToken : undefined;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["autoBranchCreationConfig"] = state ? state.autoBranchCreationConfig : undefined;
resourceInputs["autoBranchCreationPatterns"] = state ? state.autoBranchCreationPatterns : undefined;
resourceInputs["basicAuthCredentials"] = state ? state.basicAuthCredentials : undefined;
resourceInputs["buildSpec"] = state ? state.buildSpec : undefined;
resourceInputs["cacheConfig"] = state ? state.cacheConfig : undefined;
resourceInputs["computeRoleArn"] = state ? state.computeRoleArn : undefined;
resourceInputs["customHeaders"] = state ? state.customHeaders : undefined;
resourceInputs["customRules"] = state ? state.customRules : undefined;
resourceInputs["defaultDomain"] = state ? state.defaultDomain : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["enableAutoBranchCreation"] = state ? state.enableAutoBranchCreation : undefined;
resourceInputs["enableBasicAuth"] = state ? state.enableBasicAuth : undefined;
resourceInputs["enableBranchAutoBuild"] = state ? state.enableBranchAutoBuild : undefined;
resourceInputs["enableBranchAutoDeletion"] = state ? state.enableBranchAutoDeletion : undefined;
resourceInputs["environmentVariables"] = state ? state.environmentVariables : undefined;
resourceInputs["iamServiceRoleArn"] = state ? state.iamServiceRoleArn : undefined;
resourceInputs["jobConfig"] = state ? state.jobConfig : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["oauthToken"] = state ? state.oauthToken : undefined;
resourceInputs["platform"] = state ? state.platform : undefined;
resourceInputs["productionBranches"] = state ? state.productionBranches : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["repository"] = state ? state.repository : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
}
else {
const args = argsOrState;
resourceInputs["accessToken"] = (args === null || args === void 0 ? void 0 : args.accessToken) ? pulumi.secret(args.accessToken) : undefined;
resourceInputs["autoBranchCreationConfig"] = args ? args.autoBranchCreationConfig : undefined;
resourceInputs["autoBranchCreationPatterns"] = args ? args.autoBranchCreationPatterns : undefined;
resourceInputs["basicAuthCredentials"] = (args === null || args === void 0 ? void 0 : args.basicAuthCredentials) ? pulumi.secret(args.basicAuthCredentials) : undefined;
resourceInputs["buildSpec"] = args ? args.buildSpec : undefined;
resourceInputs["cacheConfig"] = args ? args.cacheConfig : undefined;
resourceInputs["computeRoleArn"] = args ? args.computeRoleArn : undefined;
resourceInputs["customHeaders"] = args ? args.customHeaders : undefined;
resourceInputs["customRules"] = args ? args.customRules : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enableAutoBranchCreation"] = args ? args.enableAutoBranchCreation : undefined;
resourceInputs["enableBasicAuth"] = args ? args.enableBasicAuth : undefined;
resourceInputs["enableBranchAutoBuild"] = args ? args.enableBranchAutoBuild : undefined;
resourceInputs["enableBranchAutoDeletion"] = args ? args.enableBranchAutoDeletion : undefined;
resourceInputs["environmentVariables"] = args ? args.environmentVariables : undefined;
resourceInputs["iamServiceRoleArn"] = args ? args.iamServiceRoleArn : undefined;
resourceInputs["jobConfig"] = args ? args.jobConfig : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["oauthToken"] = (args === null || args === void 0 ? void 0 : args.oauthToken) ? pulumi.secret(args.oauthToken) : undefined;
resourceInputs["platform"] = args ? args.platform : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["repository"] = args ? args.repository : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["defaultDomain"] = undefined /*out*/;
resourceInputs["productionBranches"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["accessToken", "basicAuthCredentials", "oauthToken"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(App.__pulumiType, name, resourceInputs, opts);
}
}
exports.App = App;
/** @internal */
App.__pulumiType = 'aws:amplify/app:App';
//# sourceMappingURL=app.js.map