@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
341 lines • 14.4 kB
JavaScript
"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
*
* ```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",
* },
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import CodeBuild Project using the `name`. For example:
*
* ```sh
* $ pulumi import aws:codebuild/project: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, Object.assign(Object.assign({}, 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 ? state.arn : undefined;
resourceInputs["artifacts"] = state ? state.artifacts : undefined;
resourceInputs["badgeEnabled"] = state ? state.badgeEnabled : undefined;
resourceInputs["badgeUrl"] = state ? state.badgeUrl : undefined;
resourceInputs["buildBatchConfig"] = state ? state.buildBatchConfig : undefined;
resourceInputs["buildTimeout"] = state ? state.buildTimeout : undefined;
resourceInputs["cache"] = state ? state.cache : undefined;
resourceInputs["concurrentBuildLimit"] = state ? state.concurrentBuildLimit : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["encryptionKey"] = state ? state.encryptionKey : undefined;
resourceInputs["environment"] = state ? state.environment : undefined;
resourceInputs["fileSystemLocations"] = state ? state.fileSystemLocations : undefined;
resourceInputs["logsConfig"] = state ? state.logsConfig : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["projectVisibility"] = state ? state.projectVisibility : undefined;
resourceInputs["publicProjectAlias"] = state ? state.publicProjectAlias : undefined;
resourceInputs["queuedTimeout"] = state ? state.queuedTimeout : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["resourceAccessRole"] = state ? state.resourceAccessRole : undefined;
resourceInputs["secondaryArtifacts"] = state ? state.secondaryArtifacts : undefined;
resourceInputs["secondarySourceVersions"] = state ? state.secondarySourceVersions : undefined;
resourceInputs["secondarySources"] = state ? state.secondarySources : undefined;
resourceInputs["serviceRole"] = state ? state.serviceRole : undefined;
resourceInputs["source"] = state ? state.source : undefined;
resourceInputs["sourceVersion"] = state ? state.sourceVersion : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["vpcConfig"] = state ? state.vpcConfig : undefined;
}
else {
const args = argsOrState;
if ((!args || args.artifacts === undefined) && !opts.urn) {
throw new Error("Missing required property 'artifacts'");
}
if ((!args || args.environment === undefined) && !opts.urn) {
throw new Error("Missing required property 'environment'");
}
if ((!args || args.serviceRole === undefined) && !opts.urn) {
throw new Error("Missing required property 'serviceRole'");
}
if ((!args || args.source === undefined) && !opts.urn) {
throw new Error("Missing required property 'source'");
}
resourceInputs["artifacts"] = args ? args.artifacts : undefined;
resourceInputs["badgeEnabled"] = args ? args.badgeEnabled : undefined;
resourceInputs["buildBatchConfig"] = args ? args.buildBatchConfig : undefined;
resourceInputs["buildTimeout"] = args ? args.buildTimeout : undefined;
resourceInputs["cache"] = args ? args.cache : undefined;
resourceInputs["concurrentBuildLimit"] = args ? args.concurrentBuildLimit : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["encryptionKey"] = args ? args.encryptionKey : undefined;
resourceInputs["environment"] = args ? args.environment : undefined;
resourceInputs["fileSystemLocations"] = args ? args.fileSystemLocations : undefined;
resourceInputs["logsConfig"] = args ? args.logsConfig : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["projectVisibility"] = args ? args.projectVisibility : undefined;
resourceInputs["queuedTimeout"] = args ? args.queuedTimeout : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["resourceAccessRole"] = args ? args.resourceAccessRole : undefined;
resourceInputs["secondaryArtifacts"] = args ? args.secondaryArtifacts : undefined;
resourceInputs["secondarySourceVersions"] = args ? args.secondarySourceVersions : undefined;
resourceInputs["secondarySources"] = args ? args.secondarySources : undefined;
resourceInputs["serviceRole"] = args ? args.serviceRole : undefined;
resourceInputs["source"] = args ? args.source : undefined;
resourceInputs["sourceVersion"] = args ? args.sourceVersion : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcConfig"] = args ? args.vpcConfig : undefined;
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