Skip to content

Commit

Permalink
resource/aws_codebuild_project: Add ARM_CONTAINER as valid `environ…
Browse files Browse the repository at this point in the history
…ment` configuration block `compute_type` argument value (#11206)

Output from acceptance testing (will remove failing `TestCheckResourceAttr()` from `TestAccAWSCodeBuildProject_ARMContainer` on merge):

```
--- PASS: TestAccAWSCodeBuildProject_Source_Type_CodePipeline (35.18s)
--- PASS: TestAccAWSCodeBuildProject_BuildTimeout (63.19s)
--- PASS: TestAccAWSCodeBuildProject_BadgeEnabled (63.34s)
--- PASS: TestAccAWSCodeBuildProject_Environment_EnvironmentVariable (68.00s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_GitHubEnterprise (56.84s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_NoSourceInvalid (11.66s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHubEnterprise (78.82s)
--- PASS: TestAccAWSCodeBuildProject_EncryptionKey (78.93s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_S3 (45.62s)
--- PASS: TestAccAWSCodeBuildProject_Source_GitCloneDepth (81.69s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_Bitbucket (86.06s)
--- PASS: TestAccAWSCodeBuildProject_Environment_Certificate (89.83s)
--- PASS: TestAccAWSCodeBuildProject_LogsConfig_CloudWatchLogs (91.38s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_Bitbucket (93.39s)
--- FAIL: TestAccAWSCodeBuildProject_ARMContainer (42.52s)
    testing.go:635: Step 0 error: Check failed: Check 3/8 error: aws_codebuild_project.test: Attribute 'environment.2306861956.compute_type' not found
--- PASS: TestAccAWSCodeBuildProject_WindowsContainer (48.15s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_NoSource (60.17s)
--- PASS: TestAccAWSCodeBuildProject_Source_InsecureSSL (125.31s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_OverrideArtifactName (45.70s)
--- PASS: TestAccAWSCodeBuildProject_Tags (81.85s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Location (75.75s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Packaging (66.93s)
--- SKIP: TestAccAWSCodeBuildProject_SecondaryArtifacts_Name (0.00s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Name (77.10s)
--- PASS: TestAccAWSCodeBuildProject_basic (166.17s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_ArtifactIdentifier (91.77s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_NamespaceType (82.44s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_ArtifactIdentifier (49.91s)
--- PASS: TestAWSCodeBuildProject_nameValidation (0.00s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Path (62.48s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Type (60.80s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_EncryptionDisabled (42.36s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts (74.98s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Packaging (39.93s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Location (45.97s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Type (33.83s)
--- PASS: TestAccAWSCodeBuildProject_SecondarySources_CodeCommit (36.97s)
--- PASS: TestAccAWSCodeBuildProject_LogsConfig_S3Logs (210.63s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_NamespaceType (50.36s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHub (218.97s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_EncryptionDisabled (138.94s)
--- PASS: TestAccAWSCodeBuildProject_Environment_RegistryCredential (47.72s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_OverrideArtifactName (87.84s)
--- PASS: TestAccAWSCodeBuildProject_Environment_EnvironmentVariable_Type (227.59s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Path (84.66s)
--- PASS: TestAccAWSCodeBuildProject_Description (253.03s)
--- PASS: TestAccAWSCodeBuildProject_VpcConfig (248.65s)
--- PASS: TestAccAWSCodeBuildProject_Cache (345.71s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_CodeCommit (379.34s)
```
  • Loading branch information
kabej authored and bflad committed Dec 10, 2019
1 parent 2cd7bee commit 6a3f383
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions aws/resource_aws_codebuild_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func resourceAwsCodeBuildProject() *schema.Resource {
codebuild.EnvironmentTypeLinuxContainer,
codebuild.EnvironmentTypeLinuxGpuContainer,
codebuild.EnvironmentTypeWindowsContainer,
codebuild.EnvironmentTypeArmContainer,
}, false),
},
"image_pull_credentials_type": {
Expand Down
56 changes: 56 additions & 0 deletions aws/resource_aws_codebuild_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,38 @@ func TestAccAWSCodeBuildProject_WindowsContainer(t *testing.T) {
})
}

func TestAccAWSCodeBuildProject_ARMContainer(t *testing.T) {
var project codebuild.Project
rName := acctest.RandomWithPrefix("tf-acc-test")
resourceName := "aws_codebuild_project.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSCodeBuildProjectConfig_ARMContainer(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSCodeBuildProjectExists(resourceName, &project),
resource.TestCheckResourceAttr(resourceName, "environment.#", "1"),
resource.TestCheckResourceAttr(resourceName, "environment.2306861956.compute_type", "BUILD_GENERAL1_LARGE"),
resource.TestCheckResourceAttr(resourceName, "environment.2306861956.environment_variable.#", "0"),
resource.TestCheckResourceAttr(resourceName, "environment.2306861956.image", "2"),
resource.TestCheckResourceAttr(resourceName, "environment.2306861956.privileged_mode", "false"),
resource.TestCheckResourceAttr(resourceName, "environment.2306861956.image_pull_credentials_type", "CODEBUILD"),
resource.TestCheckResourceAttr(resourceName, "environment.2306861956.type", "ARM_CONTAINER"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAWSCodeBuildProject_Artifacts_ArtifactIdentifier(t *testing.T) {
var project codebuild.Project
rName := acctest.RandomWithPrefix("tf-acc-test")
Expand Down Expand Up @@ -2896,6 +2928,30 @@ resource "aws_codebuild_project" "test" {
`, rName, testAccAWSCodeBuildGitHubSourceLocationFromEnv())
}

func testAccAWSCodeBuildProjectConfig_ARMContainer(rName string) string {
return testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName) + fmt.Sprintf(`
resource "aws_codebuild_project" "test" {
name = "%s"
service_role = "${aws_iam_role.test.arn}"
artifacts {
type = "NO_ARTIFACTS"
}
environment {
compute_type = "BUILD_GENERAL1_LARGE"
image = "2"
type = "ARM_CONTAINER"
}
source {
location = "%s"
type = "GITHUB"
}
}
`, rName, testAccAWSCodeBuildGitHubSourceLocationFromEnv())
}

func testAccAWSCodebuildProjectConfig_Artifacts_ArtifactIdentifier(rName string, bName string, artifactIdentifier string) string {
return testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName) + testAccAWSCodeBuildProjectConfig_Base_Bucket(bName) + fmt.Sprintf(`
resource "aws_codebuild_project" "test" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/codebuild_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ The following arguments are supported:

* `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`, `BUILD_GENERAL1_LARGE` or `BUILD_GENERAL1_2XLARGE`. `BUILD_GENERAL1_SMALL` is only valid if `type` is set to `LINUX_CONTAINER`. When `type` is set to `LINUX_GPU_CONTAINER`, `compute_type` need to be `BUILD_GENERAL1_LARGE`.
* `image` - (Required) The Docker image to use for this build project. Valid values include [Docker images provided by CodeBuild](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html) (e.g `aws/codebuild/standard:2.0`), [Docker Hub images](https://hub.docker.com/) (e.g. `hashicorp/terraform:latest`), and full Docker repository URIs such as those for ECR (e.g. `137112412989.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latest`).
* `type` - (Required) The type of build environment to use for related builds. Available values are: `LINUX_CONTAINER`, `LINUX_GPU_CONTAINER` or `WINDOWS_CONTAINER`.
* `type` - (Required) The type of build environment to use for related builds. Available values are: `LINUX_CONTAINER`, `LINUX_GPU_CONTAINER`, `WINDOWS_CONTAINER` or `ARM_CONTAINER`.
* `image_pull_credentials_type` - (Optional) The type of credentials AWS CodeBuild uses to pull images in your build. Available values for this parameter are `CODEBUILD` or `SERVICE_ROLE`. When you use a cross-account or private registry image, you must use SERVICE_ROLE credentials. When you use an AWS CodeBuild curated image, you must use CODEBUILD credentials. Default to `CODEBUILD`
* `environment_variable` - (Optional) A set of environment variables to make available to builds for this build project.
* `privileged_mode` - (Optional) If set to true, enables running the Docker daemon inside a Docker container. Defaults to `false`.
Expand Down

0 comments on commit 6a3f383

Please sign in to comment.