UNPKG

@pulumi/aws

Version:

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

356 lines • 14 kB
"use strict"; // *** 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.Project = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a CodeBuild Project resource. See also the * `aws.codebuild.Webhook` resource, which manages the webhook to the * source (e.g., the "rebuild every time a code change is pushed" option in the CodeBuild web console). * * ## Example Usage * * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const exampleBucket = new aws.s3.Bucket("example", {bucket: "example"}); * const exampleBucketAcl = new aws.s3.BucketAcl("example", { * bucket: exampleBucket.id, * acl: "private", * }); * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * principals: [{ * type: "Service", * identifiers: ["codebuild.amazonaws.com"], * }], * actions: ["sts:AssumeRole"], * }], * }); * const exampleRole = new aws.iam.Role("example", { * name: "example", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const example = pulumi.all([exampleBucket.arn, exampleBucket.arn]).apply(([exampleBucketArn, exampleBucketArn1]) => aws.iam.getPolicyDocumentOutput({ * statements: [ * { * effect: "Allow", * actions: [ * "logs:CreateLogGroup", * "logs:CreateLogStream", * "logs:PutLogEvents", * ], * resources: ["*"], * }, * { * effect: "Allow", * actions: [ * "ec2:CreateNetworkInterface", * "ec2:DescribeDhcpOptions", * "ec2:DescribeNetworkInterfaces", * "ec2:DeleteNetworkInterface", * "ec2:DescribeSubnets", * "ec2:DescribeSecurityGroups", * "ec2:DescribeVpcs", * ], * resources: ["*"], * }, * { * effect: "Allow", * actions: ["ec2:CreateNetworkInterfacePermission"], * resources: ["arn:aws:ec2:us-east-1:123456789012:network-interface/*"], * conditions: [ * { * test: "StringEquals", * variable: "ec2:Subnet", * values: [ * example1.arn, * example2.arn, * ], * }, * { * test: "StringEquals", * variable: "ec2:AuthorizedService", * values: ["codebuild.amazonaws.com"], * }, * ], * }, * { * effect: "Allow", * actions: ["s3:*"], * resources: [ * exampleBucketArn, * `${exampleBucketArn1}/*`, * ], * }, * { * effect: "Allow", * actions: [ * "codeconnections:GetConnectionToken", * "codeconnections:GetConnection", * ], * resources: ["arn:aws:codestar-connections:us-east-1:123456789012:connection/guid-string"], * }, * ], * })); * const exampleRolePolicy = new aws.iam.RolePolicy("example", { * role: exampleRole.name, * policy: example.apply(example => example.json), * }); * const exampleProject = new aws.codebuild.Project("example", { * name: "test-project", * description: "test_codebuild_project", * buildTimeout: 5, * serviceRole: exampleRole.arn, * artifacts: { * type: "NO_ARTIFACTS", * }, * cache: { * type: "S3", * location: exampleBucket.bucket, * }, * environment: { * computeType: "BUILD_GENERAL1_SMALL", * image: "aws/codebuild/amazonlinux2-x86_64-standard:4.0", * type: "LINUX_CONTAINER", * imagePullCredentialsType: "CODEBUILD", * environmentVariables: [ * { * name: "SOME_KEY1", * value: "SOME_VALUE1", * }, * { * name: "SOME_KEY2", * value: "SOME_VALUE2", * type: "PARAMETER_STORE", * }, * ], * }, * logsConfig: { * cloudwatchLogs: { * groupName: "log-group", * streamName: "log-stream", * }, * s3Logs: { * status: "ENABLED", * location: pulumi.interpolate`${exampleBucket.id}/build-log`, * }, * }, * source: { * type: "GITHUB", * location: "https://github.com/mitchellh/packer.git", * gitCloneDepth: 1, * gitSubmodulesConfig: { * fetchSubmodules: true, * }, * }, * sourceVersion: "master", * vpcConfig: { * vpcId: exampleAwsVpc.id, * subnets: [ * example1.id, * example2.id, * ], * securityGroupIds: [ * example1AwsSecurityGroup.id, * example2AwsSecurityGroup.id, * ], * }, * tags: { * Environment: "Test", * }, * }); * const project_with_cache = new aws.codebuild.Project("project-with-cache", { * name: "test-project-cache", * description: "test_codebuild_project_cache", * buildTimeout: 5, * queuedTimeout: 5, * serviceRole: exampleRole.arn, * artifacts: { * type: "NO_ARTIFACTS", * }, * cache: { * type: "LOCAL", * modes: [ * "LOCAL_DOCKER_LAYER_CACHE", * "LOCAL_SOURCE_CACHE", * ], * }, * environment: { * computeType: "BUILD_GENERAL1_SMALL", * image: "aws/codebuild/amazonlinux2-x86_64-standard:4.0", * type: "LINUX_CONTAINER", * imagePullCredentialsType: "CODEBUILD", * environmentVariables: [{ * name: "SOME_KEY1", * value: "SOME_VALUE1", * }], * }, * source: { * type: "GITHUB", * location: "https://github.com/mitchellh/packer.git", * gitCloneDepth: 1, * }, * tags: { * Environment: "Test", * }, * }); * const project_using_github_app = new aws.codebuild.Project("project-using-github-app", { * name: "project-using-github-app", * description: "gets_source_from_github_via_the_github_app", * serviceRole: exampleRole.arn, * artifacts: { * type: "NO_ARTIFACTS", * }, * environment: { * computeType: "BUILD_GENERAL1_SMALL", * image: "aws/codebuild/amazonlinux2-x86_64-standard:4.0", * type: "LINUX_CONTAINER", * imagePullCredentialsType: "CODEBUILD", * }, * source: { * type: "GITHUB", * location: "https://github.com/example/example.git", * auth: { * type: "CODECONNECTIONS", * resource: "arn:aws:codestar-connections:us-east-1:123456789012:connection/guid-string", * }, * }, * }); * ``` * * ### Runner Project * * While no special configuration is required for `aws.codebuild.Project` to create a project as a Runner Project, an `aws.codebuild.Webhook` resource with an appropriate `filterGroup` is required. * See the `aws.codebuild.Webhook` resource documentation example for more details. * * ## Import * * ### Identity Schema * * #### Required * * - `arn` (String) Amazon Resource Name (ARN) of the CodeBuild project. * * Using `pulumi import`, import CodeBuild Project using the `name`. For example: * * console * * % pulumi import aws_codebuild_project.name project-name */ class Project extends pulumi.CustomResource { /** * Get an existing Project 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 Project(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Project. 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'] === Project.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["artifacts"] = state?.artifacts; resourceInputs["autoRetryLimit"] = state?.autoRetryLimit; resourceInputs["badgeEnabled"] = state?.badgeEnabled; resourceInputs["badgeUrl"] = state?.badgeUrl; resourceInputs["buildBatchConfig"] = state?.buildBatchConfig; resourceInputs["buildTimeout"] = state?.buildTimeout; resourceInputs["cache"] = state?.cache; resourceInputs["concurrentBuildLimit"] = state?.concurrentBuildLimit; resourceInputs["description"] = state?.description; resourceInputs["encryptionKey"] = state?.encryptionKey; resourceInputs["environment"] = state?.environment; resourceInputs["fileSystemLocations"] = state?.fileSystemLocations; resourceInputs["logsConfig"] = state?.logsConfig; resourceInputs["name"] = state?.name; resourceInputs["projectVisibility"] = state?.projectVisibility; resourceInputs["publicProjectAlias"] = state?.publicProjectAlias; resourceInputs["queuedTimeout"] = state?.queuedTimeout; resourceInputs["region"] = state?.region; resourceInputs["resourceAccessRole"] = state?.resourceAccessRole; resourceInputs["secondaryArtifacts"] = state?.secondaryArtifacts; resourceInputs["secondarySourceVersions"] = state?.secondarySourceVersions; resourceInputs["secondarySources"] = state?.secondarySources; resourceInputs["serviceRole"] = state?.serviceRole; resourceInputs["source"] = state?.source; resourceInputs["sourceVersion"] = state?.sourceVersion; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["vpcConfig"] = state?.vpcConfig; } else { const args = argsOrState; if (args?.artifacts === undefined && !opts.urn) { throw new Error("Missing required property 'artifacts'"); } if (args?.environment === undefined && !opts.urn) { throw new Error("Missing required property 'environment'"); } if (args?.serviceRole === undefined && !opts.urn) { throw new Error("Missing required property 'serviceRole'"); } if (args?.source === undefined && !opts.urn) { throw new Error("Missing required property 'source'"); } resourceInputs["artifacts"] = args?.artifacts; resourceInputs["autoRetryLimit"] = args?.autoRetryLimit; resourceInputs["badgeEnabled"] = args?.badgeEnabled; resourceInputs["buildBatchConfig"] = args?.buildBatchConfig; resourceInputs["buildTimeout"] = args?.buildTimeout; resourceInputs["cache"] = args?.cache; resourceInputs["concurrentBuildLimit"] = args?.concurrentBuildLimit; resourceInputs["description"] = args?.description; resourceInputs["encryptionKey"] = args?.encryptionKey; resourceInputs["environment"] = args?.environment; resourceInputs["fileSystemLocations"] = args?.fileSystemLocations; resourceInputs["logsConfig"] = args?.logsConfig; resourceInputs["name"] = args?.name; resourceInputs["projectVisibility"] = args?.projectVisibility; resourceInputs["queuedTimeout"] = args?.queuedTimeout; resourceInputs["region"] = args?.region; resourceInputs["resourceAccessRole"] = args?.resourceAccessRole; resourceInputs["secondaryArtifacts"] = args?.secondaryArtifacts; resourceInputs["secondarySourceVersions"] = args?.secondarySourceVersions; resourceInputs["secondarySources"] = args?.secondarySources; resourceInputs["serviceRole"] = args?.serviceRole; resourceInputs["source"] = args?.source; resourceInputs["sourceVersion"] = args?.sourceVersion; resourceInputs["tags"] = args?.tags; resourceInputs["vpcConfig"] = args?.vpcConfig; resourceInputs["arn"] = undefined /*out*/; resourceInputs["badgeUrl"] = undefined /*out*/; resourceInputs["publicProjectAlias"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Project.__pulumiType, name, resourceInputs, opts); } } exports.Project = Project; /** @internal */ Project.__pulumiType = 'aws:codebuild/project:Project'; //# sourceMappingURL=project.js.map