github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/codebuild_project.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_codebuild_project"
     4  sidebar_current: "docs-aws-resource-codebuild-project"
     5  description: |-
     6    Provides a CodeBuild Project resource.
     7  ---
     8  
     9  # aws\_codebuild\_project
    10  
    11  Provides a CodeBuild Project resource.
    12  
    13  ## Example Usage
    14  
    15  ```hcl
    16  resource "aws_iam_role" "codebuild_role" {
    17    name = "codebuild-role-"
    18  
    19    assume_role_policy = <<EOF
    20  {
    21    "Version": "2012-10-17",
    22    "Statement": [
    23      {
    24        "Effect": "Allow",
    25        "Principal": {
    26          "Service": "codebuild.amazonaws.com"
    27        },
    28        "Action": "sts:AssumeRole"
    29      }
    30    ]
    31  }
    32  EOF
    33  }
    34  
    35  resource "aws_iam_policy" "codebuild_policy" {
    36    name        = "codebuild-policy"
    37    path        = "/service-role/"
    38    description = "Policy used in trust relationship with CodeBuild"
    39  
    40    policy = <<POLICY
    41  {
    42    "Version": "2012-10-17",
    43    "Statement": [
    44      {
    45        "Effect": "Allow",
    46        "Resource": [
    47          "*"
    48        ],
    49        "Action": [
    50          "logs:CreateLogGroup",
    51          "logs:CreateLogStream",
    52          "logs:PutLogEvents"
    53        ]
    54      }
    55    ]
    56  }
    57  POLICY
    58  }
    59  
    60  resource "aws_iam_policy_attachment" "codebuild_policy_attachment" {
    61    name       = "codebuild-policy-attachment"
    62    policy_arn = "${aws_iam_policy.codebuild_policy.arn}"
    63    roles      = ["${aws_iam_role.codebuild_role.id}"]
    64  }
    65  
    66  resource "aws_codebuild_project" "foo" {
    67    name         = "test-project"
    68    description  = "test_codebuild_project"
    69    build_timeout      = "5"
    70    service_role = "${aws_iam_role.codebuild_role.arn}"
    71  
    72    artifacts {
    73      type = "NO_ARTIFACTS"
    74    }
    75  
    76    environment {
    77      compute_type = "BUILD_GENERAL1_SMALL"
    78      image        = "2"
    79      type         = "LINUX_CONTAINER"
    80  
    81      environment_variable {
    82        "name"  = "SOME_KEY1"
    83        "value" = "SOME_VALUE1"
    84      }
    85  
    86      environment_variable {
    87        "name"  = "SOME_KEY2"
    88        "value" = "SOME_VALUE2"
    89      }
    90    }
    91  
    92    source {
    93      type     = "GITHUB"
    94      location = "https://github.com/mitchellh/packer.git"
    95    }
    96  
    97    tags {
    98      "Environment" = "Test"
    99    }
   100  }
   101  ```
   102  
   103  ## Argument Reference
   104  
   105  The following arguments are supported:
   106  
   107  * `name` - (Required) The projects name.
   108  * `description` - (Optional) A short description of the project.
   109  * `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.
   110  * `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.
   111  * `build_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.
   112  * `tags` - (Optional) A mapping of tags to assign to the resource.
   113  * `artifacts` - (Required) Information about the project's build output artifacts. Artifact blocks are documented below.
   114  * `environment` - (Required) Information about the project's build environment. Environment blocks are documented below.
   115  * `source` - (Required) Information about the project's input source code. Source blocks are documented below.
   116  
   117  `artifacts` supports the following:
   118  
   119  * `type` - (Required) The build output artifact's type. Valid values for this parameter are: `CODEPIPELINE`, `NO_ARTIFACTS` or `S3`.
   120  * `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.
   121  * `name` - (Optional) The name of the project. If `type` is set to `S3`, this is the name of the output artifact object
   122  * `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`.
   123  * `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`
   124  * `path` - (Optional) If `type` is set to `S3`, this is the path to the output artifact
   125  
   126  `environment` supports the following:
   127  
   128  * `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`
   129  * `image` - (Required) The ID of the Docker image to use for this build project
   130  * `type` - (Required) The type of build environment to use for related builds. The only valid value is `LINUX_CONTAINER`.
   131  * `environment_variable` - (Optional) A set of environment variables to make available to builds for this build project.
   132  
   133  `environment_variable` supports the following:
   134  * `name` - (Required) The environment variable's name or key.
   135  * `value` - (Required) The environment variable's value.
   136  
   137  `source` supports the following:
   138  
   139  * `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`.
   140  * `auth` - (Optional) Information about the authorization settings for AWS CodeBuild to access the source code to be built. Auth blocks are documented below.
   141  * `buildspec` - (Optional) The build spec declaration to use for this build project's related builds.
   142  * `location` - (Optional) The location of the source code from git or s3.
   143  
   144  `auth` supports the following:
   145  
   146  * `type` - (Required) The authorization type to use. The only valid value is `OAUTH`
   147  * `resource` - (Optional) The resource value that applies to the specified authorization type.
   148  
   149  ## Attributes Reference
   150  
   151  The following attributes are exported:
   152  
   153  * `id` - The ARN of the CodeBuild project.
   154  * `description` - A short description of the project.
   155  * `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.
   156  * `name` - The projects name.
   157  * `service_role` - The ARN of the IAM service role.
   158