Skip to content

Commit 5a84991

Browse files
liamjbennettstack72
authored andcommitted
adding documentation for aws_codebuild_project resource
1 parent 281bbfc commit 5a84991

2 files changed

Lines changed: 169 additions & 0 deletions

File tree

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
layout: "aws"
3+
page_title: "AWS: aws_codebuild_project"
4+
sidebar_current: "docs-aws-resource-codebuild-project"
5+
description: |-
6+
Provides n CodeBuild Project resource.
7+
---
8+
9+
# aws\_codebuild\_project
10+
11+
Provides a CodeBuild Project resource.
12+
13+
## Example Usage
14+
15+
```
16+
resource "aws_iam_role" "codebuild_role" {
17+
name = "codebuild-role-"
18+
assume_role_policy = <<EOF
19+
{
20+
"Version": "2012-10-17",
21+
"Statement": [
22+
{
23+
"Effect": "Allow",
24+
"Principal": {
25+
"Service": "codebuild.amazonaws.com"
26+
},
27+
"Action": "sts:AssumeRole"
28+
}
29+
]
30+
}
31+
EOF
32+
}
33+
34+
resource "aws_iam_policy" "codebuild_policy" {
35+
name = "codebuild-policy"
36+
path = "/service-role/"
37+
description = "Policy used in trust relationship with CodeBuild"
38+
policy = <<POLICY
39+
{
40+
"Version": "2012-10-17",
41+
"Statement": [
42+
{
43+
"Effect": "Allow",
44+
"Resource": [
45+
"*"
46+
],
47+
"Action": [
48+
"logs:CreateLogGroup",
49+
"logs:CreateLogStream",
50+
"logs:PutLogEvents"
51+
]
52+
}
53+
]
54+
}
55+
POLICY
56+
}
57+
58+
resource "aws_iam_policy_attachment" "codebuild_policy_attachment" {
59+
name = "codebuild-policy-attachment"
60+
policy_arn = "${aws_iam_policy.codebuild_policy.arn}"
61+
roles = ["${aws_iam_role.codebuild_role.id}"]
62+
}
63+
64+
resource "aws_codebuild_project" "foo" {
65+
name = "test-project"
66+
description = "test_codebuild_project"
67+
timeout = "5"
68+
service_role = "${aws_iam_role.codebuild_role.arn}"
69+
70+
artifacts {
71+
type = "NO_ARTIFACTS"
72+
}
73+
74+
environment {
75+
compute_type = "BUILD_GENERAL1_SMALL"
76+
image = "2"
77+
type = "LINUX_CONTAINER"
78+
79+
environment_variable = {
80+
"name" = "SOME_KEY"
81+
"value" = "SOME_VALUE"
82+
}
83+
}
84+
85+
source {
86+
type = "GITHUB"
87+
location = "https://github.com/mitchellh/packer.git"
88+
}
89+
90+
tags {
91+
"Environment" = "Test"
92+
}
93+
}
94+
```
95+
96+
## Argument Reference
97+
98+
The following arguments are supported:
99+
100+
* `name` - (Required) The projects name.
101+
* `description` - (Optional) A short description of the project.
102+
* `encryption_key` - (Optional) The AWS Key Management Service (AWS KMS) customer master key (CMK) to be used for encrypting the build project's build output artifacts.
103+
* `service_role` - (Optional) The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that enables AWS CodeBuild to interact with dependent AWS services on behalf of the AWS account.
104+
* `timeout` - (Optional) How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. The default is 60 minutes.
105+
* `tags` - (Optional) A mapping of tags to assign to the resource.
106+
* `artifacts` - (Optional) Information about the project's build output artifacts. Artifact blocks are documented below.
107+
* `environment` - (Optional) Information about the project's build environment. Environment blocks are documented below.
108+
* `source` - (Optional) Information about the project's input source code. Source blocks are documented below.
109+
110+
`artifacts` supports the following:
111+
112+
* `type` - (Required) The build output artifact's type. Valid values for this parameter are: `CODEPIPELINE`, `NO_ARTIFACTS` or `S3`.
113+
* `location` - (Optional) Information about the build output artifact location. If `type` is set to `CODEPIPELINE` or `NO_ARTIFACTS` then this value will be ignored. If `type` is set to `S3`, this is the name of the output bucket. If `path` is not also specified, then `location` can also specify the path of the output artifact in the output bucket.
114+
* `name` - (Optional) The name of the project. If `type` is set to `S3`, this is the name of the output artifact object
115+
* `namespace_type` - (Optional) The namespace to use in storing build artifacts. If `type` is set to `S3`, then valid values for this parameter are: `BUILD_ID` or `NONE`.
116+
* `packaging` - (Optional) The type of build output artifact to create. If `type` is set to `S3`, valid values for this parameter are: `NONE` or `ZIP`
117+
* `path` - (Optional) If `type` is set to `S3`, this is the path to the output artifact
118+
119+
`environment` supports the following:
120+
121+
* `compute_type` - (Required) Information about the compute resources the build project will use. Available values for this parameter are: `BUILD_GENERAL1_SMALL`, `BUILD_GENERAL1_MEDIUM` or `BUILD_GENERAL1_LARGE`
122+
* `image` - (Required) The ID of the Docker image to use for this build project
123+
* `type` - (Required) The type of build environment to use for related builds. The only valid value is `LINUX_CONTAINER`.
124+
* `environment_variable` - (Optional) A set of environment variables to make available to builds for this build project.
125+
126+
`environment_variable` supports the following:
127+
* `name` - (Required) The environment variable's name or key.
128+
* `value` - (Required) The environment variable's value.
129+
130+
`source` supports the following:
131+
132+
* `type` - (Required) The type of repository that contains the source code to be built. Valid values for this parameter are: `CODECOMMIT`, `CODEPIPELINE`, `GITHUB` or `S3`.
133+
* `auth` - (Optional) Information about the authorization settings for AWS CodeBuild to access the source code to be built. Auth blocks are documented below.
134+
* `buildspec` - (Optional) The build spec declaration to use for this build project's related builds.
135+
* `location` - (Optional) The location of the source code from git or s3.
136+
137+
`auth` supports the following:
138+
139+
* `type` - (Required) The authorization type to use. The only valid value is `OAUTH`
140+
* `resource` - (Required) The resource value that applies to the specified authorization type.
141+
142+
## Attributes Reference
143+
144+
The following attributes are exported:
145+
146+
* `id` - The ARN of the CodeBuild project.
147+
* `description` - A short description of the project.
148+
* `encryption_key` - The AWS Key Management Service (AWS KMS) customer master key (CMK) that was used for encrypting the build project's build output artifacts.
149+
* `name` - The projects name.
150+
* `service_role` - The ARN of the IAM service role.
151+
152+
## Import
153+
154+
CodeBuild projects can be imported using the ARN, e.g
155+
156+
```
157+
$ terraform import aws_codebuild_project.test_project arn:aws:codebuild:us-east-1:123456789012:projects/test_project
158+
```

‎website/source/layouts/aws.erb‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,17 @@
245245
</ul>
246246
</li>
247247

248+
<li<%= sidebar_current(/^docs-aws-resource-codebuild/) %>>
249+
<a href="#">CodeBuild Resources</a>
250+
<ul class="nav nav-visible">
251+
252+
<li<%= sidebar_current("docs-aws-resource-codebuild-project") %>>
253+
<a href="/docs/providers/aws/r/code_build_project.html">aws_codebuild_project</a>
254+
</li>
255+
256+
</ul>
257+
</li>
258+
248259
<li<%= sidebar_current(/^docs-aws-resource-codecommit/) %>>
249260
<a href="#">CodeCommit Resources</a>
250261
<ul class="nav nav-visible">

0 commit comments

Comments
 (0)