Terraform module which creates CodeBuild resources on AWS.
Provision CodeBuild_Projects and CodeBuild Service Role.
This module provides recommended settings:
- Support CodePipeline
module "codebuild" {
source = "git::https://github.com/tmknom/terraform-aws-codebuild.git?ref=tags/2.0.0"
name = "example"
}
module "codebuild" {
source = "git::https://github.com/tmknom/terraform-aws-codebuild.git?ref=tags/2.0.0"
name = "example"
artifact_bucket_arn = var.artifact_bucket_arn
environment_type = "LINUX_CONTAINER"
compute_type = "BUILD_GENERAL1_MEDIUM"
image = "aws/codebuild/docker:18.09.0"
privileged_mode = true
buildspec = "configuration/buildspec.yml"
cache_type = "S3"
cache_location = "${aws_s3_bucket.artifact.id}/codebuild"
encryption_key = ""
build_timeout = 10
iam_path = "/service-role/"
description = "This is example"
enabled_ecr_access = true
ecr_access_policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser"
tags = {
Environment = "prod"
}
}
Name | Version |
---|---|
terraform | >= 0.12 |
Name | Version |
---|---|
aws | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | The projects name. | string |
n/a | yes |
artifact_bucket_arn | The S3 Bucket ARN of artifacts. | string |
"arn:aws:s3:::*" |
no |
build_timeout | How long in minutes to wait until timing out any related build that does not get marked as completed. | string |
60 |
no |
buildspec | The build spec declaration to use for this build project's related builds. | string |
"" |
no |
cache_location | The location where the AWS CodeBuild project stores cached resources. | string |
"" |
no |
cache_type | The type of storage that will be used for the AWS CodeBuild project cache. | string |
"NO_CACHE" |
no |
compute_type | Information about the compute resources the build project will use. | string |
"BUILD_GENERAL1_SMALL" |
no |
description | The description of the all resources. | string |
"Managed by Terraform" |
no |
ecr_access_policy_arn | The ARN specifying the IAM Role for ECR access. | string |
"arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser" |
no |
enabled_ecr_access | If set to true, enables access to ECR. | bool |
true |
no |
encryption_key | The KMS CMK to be used for encrypting the build project's build output artifacts. | string |
"" |
no |
environment_type | The type of build environment to use for related builds. | string |
"LINUX_CONTAINER" |
no |
iam_path | Path in which to create the IAM Role and the IAM Policy. | string |
"/" |
no |
image | The image identifier of the Docker image to use for this build project. | string |
"aws/codebuild/ubuntu-base:14.04" |
no |
privileged_mode | If set to true, enables running the Docker daemon inside a Docker container. | bool |
true |
no |
tags | A mapping of tags to assign to all resources. | map(string) |
{} |
no |
Name | Description |
---|---|
codebuild_project_arn | The ARN of the CodeBuild project. |
codebuild_project_id | The name (if imported via name) or ARN (if created via Terraform or imported via ARN) of the CodeBuild project. |
iam_policy_arn | The ARN assigned by AWS to this IAM Policy. |
iam_policy_description | The description of the IAM Policy. |
iam_policy_document | The policy document of the IAM Policy. |
iam_policy_id | The IAM Policy's ID. |
iam_policy_name | The name of the IAM Policy. |
iam_policy_path | The path of the IAM Policy. |
iam_role_arn | The Amazon Resource Name (ARN) specifying the IAM Role. |
iam_role_create_date | The creation date of the IAM Role. |
iam_role_description | The description of the IAM Role. |
iam_role_name | The name of the IAM Role. |
iam_role_unique_id | The stable and unique string identifying the IAM Role. |
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=ap-northeast-1
git clone [email protected]:tmknom/terraform-aws-codebuild.git
cd terraform-aws-codebuild
make install
apply-complete Run terraform apply examples/complete
apply-minimal Run terraform apply examples/minimal
bump-version Bump version (Required argument 'VERSION')
check-format Check format code
clean Clean .terraform
destroy-complete Run terraform destroy examples/complete
destroy-minimal Run terraform destroy examples/minimal
diff Word diff
docs Generate docs
format Format code
help Show help
install Install requirements
lint Lint code
plan-complete Run terraform plan examples/complete
plan-minimal Run terraform plan examples/minimal
release Release GitHub and Terraform Module Registry
upgrade Upgrade makefile
Bump VERSION file, and run make release
.
Apache 2 Licensed. See LICENSE for full details.