Project Args
data class ProjectArgs(val artifacts: Output<ProjectArtifactsArgs>? = null, val badgeEnabled: Output<Boolean>? = null, val buildBatchConfig: Output<ProjectBuildBatchConfigArgs>? = null, val buildTimeout: Output<Int>? = null, val cache: Output<ProjectCacheArgs>? = null, val concurrentBuildLimit: Output<Int>? = null, val description: Output<String>? = null, val encryptionKey: Output<String>? = null, val environment: Output<ProjectEnvironmentArgs>? = null, val fileSystemLocations: Output<List<ProjectFileSystemLocationArgs>>? = null, val logsConfig: Output<ProjectLogsConfigArgs>? = null, val name: Output<String>? = null, val projectVisibility: Output<String>? = null, val queuedTimeout: Output<Int>? = null, val resourceAccessRole: Output<String>? = null, val secondaryArtifacts: Output<List<ProjectSecondaryArtifactArgs>>? = null, val secondarySourceVersions: Output<List<ProjectSecondarySourceVersionArgs>>? = null, val secondarySources: Output<List<ProjectSecondarySourceArgs>>? = null, val serviceRole: Output<String>? = null, val source: Output<ProjectSourceArgs>? = null, val sourceVersion: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val vpcConfig: Output<ProjectVpcConfigArgs>? = null) : ConvertibleToJava<ProjectArgs>
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
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketAclV2;
import com.pulumi.aws.s3.BucketAclV2Args;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.aws.codebuild.Project;
import com.pulumi.aws.codebuild.ProjectArgs;
import com.pulumi.aws.codebuild.inputs.ProjectArtifactsArgs;
import com.pulumi.aws.codebuild.inputs.ProjectCacheArgs;
import com.pulumi.aws.codebuild.inputs.ProjectEnvironmentArgs;
import com.pulumi.aws.codebuild.inputs.ProjectLogsConfigArgs;
import com.pulumi.aws.codebuild.inputs.ProjectLogsConfigCloudwatchLogsArgs;
import com.pulumi.aws.codebuild.inputs.ProjectLogsConfigS3LogsArgs;
import com.pulumi.aws.codebuild.inputs.ProjectSourceArgs;
import com.pulumi.aws.codebuild.inputs.ProjectSourceGitSubmodulesConfigArgs;
import com.pulumi.aws.codebuild.inputs.ProjectVpcConfigArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleBucketV2 = new BucketV2("exampleBucketV2");
var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()
.bucket(exampleBucketV2.id())
.acl("private")
.build());
var exampleRole = new Role("exampleRole", RoleArgs.builder()
.assumeRolePolicy("""
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "codebuild.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
""")
.build());
var exampleRolePolicy = new RolePolicy("exampleRolePolicy", RolePolicyArgs.builder()
.role(exampleRole.name())
.policy(Output.tuple(exampleBucketV2.arn(), exampleBucketV2.arn()).applyValue(values -> {
var exampleBucketV2Arn = values.t1;
var exampleBucketV2Arn1 = values.t2;
return """
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Resource": [
"*"
],
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
]
},
{
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface",
"ec2:DescribeDhcpOptions",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface",
"ec2:DescribeSubnets",
"ec2:DescribeSecurityGroups",
"ec2:DescribeVpcs"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterfacePermission"
],
"Resource": [
"arn:aws:ec2:us-east-1:123456789012:network-interface/*"
],
"Condition": {
"StringEquals": {
"ec2:Subnet": [
"%s",
"%s"
],
"ec2:AuthorizedService": "codebuild.amazonaws.com"
}
}
},
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"%s",
"%s/*"
]
}
]
}
", aws_subnet.example1().arn(),aws_subnet.example2().arn(),exampleBucketV2Arn,exampleBucketV2Arn1);
}))
.build());
var exampleProject = new Project("exampleProject", ProjectArgs.builder()
.description("test_codebuild_project")
.buildTimeout("5")
.serviceRole(exampleRole.arn())
.artifacts(ProjectArtifactsArgs.builder()
.type("NO_ARTIFACTS")
.build())
.cache(ProjectCacheArgs.builder()
.type("S3")
.location(exampleBucketV2.bucket())
.build())
.environment(ProjectEnvironmentArgs.builder()
.computeType("BUILD_GENERAL1_SMALL")
.image("aws/codebuild/standard:1.0")
.type("LINUX_CONTAINER")
.imagePullCredentialsType("CODEBUILD")
.environmentVariables(
ProjectEnvironmentEnvironmentVariableArgs.builder()
.name("SOME_KEY1")
.value("SOME_VALUE1")
.build(),
ProjectEnvironmentEnvironmentVariableArgs.builder()
.name("SOME_KEY2")
.value("SOME_VALUE2")
.type("PARAMETER_STORE")
.build())
.build())
.logsConfig(ProjectLogsConfigArgs.builder()
.cloudwatchLogs(ProjectLogsConfigCloudwatchLogsArgs.builder()
.groupName("log-group")
.streamName("log-stream")
.build())
.s3Logs(ProjectLogsConfigS3LogsArgs.builder()
.status("ENABLED")
.location(exampleBucketV2.id().applyValue(id -> String.format("%s/build-log", id)))
.build())
.build())
.source(ProjectSourceArgs.builder()
.type("GITHUB")
.location("https://github.com/mitchellh/packer.git")
.gitCloneDepth(1)
.gitSubmodulesConfig(ProjectSourceGitSubmodulesConfigArgs.builder()
.fetchSubmodules(true)
.build())
.build())
.sourceVersion("master")
.vpcConfig(ProjectVpcConfigArgs.builder()
.vpcId(aws_vpc.example().id())
.subnets(
aws_subnet.example1().id(),
aws_subnet.example2().id())
.securityGroupIds(
aws_security_group.example1().id(),
aws_security_group.example2().id())
.build())
.tags(Map.of("Environment", "Test"))
.build());
var project_with_cache = new Project("project-with-cache", ProjectArgs.builder()
.description("test_codebuild_project_cache")
.buildTimeout("5")
.queuedTimeout("5")
.serviceRole(exampleRole.arn())
.artifacts(ProjectArtifactsArgs.builder()
.type("NO_ARTIFACTS")
.build())
.cache(ProjectCacheArgs.builder()
.type("LOCAL")
.modes(
"LOCAL_DOCKER_LAYER_CACHE",
"LOCAL_SOURCE_CACHE")
.build())
.environment(ProjectEnvironmentArgs.builder()
.computeType("BUILD_GENERAL1_SMALL")
.image("aws/codebuild/standard:1.0")
.type("LINUX_CONTAINER")
.imagePullCredentialsType("CODEBUILD")
.environmentVariables(ProjectEnvironmentEnvironmentVariableArgs.builder()
.name("SOME_KEY1")
.value("SOME_VALUE1")
.build())
.build())
.source(ProjectSourceArgs.builder()
.type("GITHUB")
.location("https://github.com/mitchellh/packer.git")
.gitCloneDepth(1)
.build())
.tags(Map.of("Environment", "Test"))
.build());
}
}
Content copied to clipboard
Import
CodeBuild Project can be imported using the name
, e.g.,
$ pulumi import aws:codebuild/project:Project name project-name
Content copied to clipboard
Constructors
Link copied to clipboard
fun ProjectArgs(artifacts: Output<ProjectArtifactsArgs>? = null, badgeEnabled: Output<Boolean>? = null, buildBatchConfig: Output<ProjectBuildBatchConfigArgs>? = null, buildTimeout: Output<Int>? = null, cache: Output<ProjectCacheArgs>? = null, concurrentBuildLimit: Output<Int>? = null, description: Output<String>? = null, encryptionKey: Output<String>? = null, environment: Output<ProjectEnvironmentArgs>? = null, fileSystemLocations: Output<List<ProjectFileSystemLocationArgs>>? = null, logsConfig: Output<ProjectLogsConfigArgs>? = null, name: Output<String>? = null, projectVisibility: Output<String>? = null, queuedTimeout: Output<Int>? = null, resourceAccessRole: Output<String>? = null, secondaryArtifacts: Output<List<ProjectSecondaryArtifactArgs>>? = null, secondarySourceVersions: Output<List<ProjectSecondarySourceVersionArgs>>? = null, secondarySources: Output<List<ProjectSecondarySourceArgs>>? = null, serviceRole: Output<String>? = null, source: Output<ProjectSourceArgs>? = null, sourceVersion: Output<String>? = null, tags: Output<Map<String, String>>? = null, vpcConfig: Output<ProjectVpcConfigArgs>? = null)
Functions
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard