Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add imagePullCredentialsType for codebuild to access cross account image #7458

Merged
merged 4 commits into from
Mar 15, 2019

Conversation

steve-ng
Copy link
Contributor

@steve-ng steve-ng commented Feb 6, 2019

Fixes #7450

Changes proposed in this pull request:

  • Added in the ability to set imagePullCredentialsType for CodeBuild resource. This would allow user to specify cross account ECR image in their CodeBuild template.

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSCodeBuildProject_'
=== RUN   TestAccAWSCodeBuildProject_importBasic
=== PAUSE TestAccAWSCodeBuildProject_importBasic
=== RUN   TestAccAWSCodeBuildProject_basic
=== PAUSE TestAccAWSCodeBuildProject_basic
=== RUN   TestAccAWSCodeBuildProject_BadgeEnabled
=== PAUSE TestAccAWSCodeBuildProject_BadgeEnabled
=== RUN   TestAccAWSCodeBuildProject_BuildTimeout
=== PAUSE TestAccAWSCodeBuildProject_BuildTimeout
=== RUN   TestAccAWSCodeBuildProject_Cache
=== PAUSE TestAccAWSCodeBuildProject_Cache
=== RUN   TestAccAWSCodeBuildProject_Description
=== PAUSE TestAccAWSCodeBuildProject_Description
=== RUN   TestAccAWSCodeBuildProject_EncryptionKey
=== PAUSE TestAccAWSCodeBuildProject_EncryptionKey
...
PASS github.com/terraform-providers/terraform-provider-aws/aws	122.961s
...

@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/codebuild Issues and PRs that pertain to the codebuild service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Feb 6, 2019
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Feb 6, 2019
@ghost ghost added size/S Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Feb 6, 2019
@simonvanderveldt
Copy link
Contributor

@bflad And chance this PR can be reviewed?
It seems like it's currently impossible to create a codebuild project using an AWS curated image with Terraform because that requires setting imagePullCredentialsType to CODEBUILD which Terraform/this provider currently doesn't support.

I'm hoping this PR fixes that problem :)

Example error:

<project-name>: [ERROR] Error updating CodeBuild project (arn:aws:codebuild:<region>:<accountid>:project/<project-name): InvalidInputException: Invalid input: cannot use a CodeBuild curated image with imagePullCredentialsType SERVICE_ROLE

@steve-ng Do you know where the default is coming from? In the docs you've mentioned CODEBUILD is the default but it's not being set in the code you changed yet when I run a terraform apply with the current AWS provider (1.60.) I get an error that SERVICE_ROLE cannot be used which seems to suggest SERVICE_ROLE is the default since it doesn't seem that's explicitly being set by the existing provider code either 😕

@jch254
Copy link

jch254 commented Feb 27, 2019

👍 this will be great!

@bflad bflad added this to the v2.3.0 milestone Mar 15, 2019
@bflad bflad self-assigned this Mar 15, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @steve-ng! 🚀

Output from acceptance testing (failure unrelated):

--- PASS: TestAccAWSCodeBuildProject_Artifacts_EncryptionDisabled (31.31s)
--- PASS: TestAccAWSCodeBuildProject_BadgeEnabled (21.83s)
--- PASS: TestAccAWSCodeBuildProject_basic (22.50s)
--- PASS: TestAccAWSCodeBuildProject_BuildTimeout (34.69s)
--- PASS: TestAccAWSCodeBuildProject_Cache (48.62s)
--- PASS: TestAccAWSCodeBuildProject_Description (32.72s)
--- PASS: TestAccAWSCodeBuildProject_EncryptionKey (54.91s)
--- PASS: TestAccAWSCodeBuildProject_Environment_Certificate (32.28s)
--- PASS: TestAccAWSCodeBuildProject_Environment_EnvironmentVariable_Type (32.15s)
--- PASS: TestAccAWSCodeBuildProject_importBasic (23.08s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts (31.40s)
--- PASS: TestAccAWSCodeBuildProject_SecondarySources_CodeCommit (21.71s)
--- PASS: TestAccAWSCodeBuildProject_Source_Auth (25.32s)
--- PASS: TestAccAWSCodeBuildProject_Source_GitCloneDepth (32.12s)
--- PASS: TestAccAWSCodeBuildProject_Source_InsecureSSL (32.07s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_Bitbucket (35.40s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHub (32.79s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHubEnterprise (30.91s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_Bitbucket (21.96s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_CodeCommit (21.70s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_CodePipeline (19.54s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_GitHubEnterprise (21.02s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_NoSource (24.83s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_NoSourceInvalid (8.32s)
--- FAIL: TestAccAWSCodeBuildProject_Source_Type_S3 (17.86s)
--- PASS: TestAccAWSCodeBuildProject_Tags (26.22s)
--- PASS: TestAccAWSCodeBuildProject_VpcConfig (48.98s)
--- PASS: TestAccAWSCodeBuildProject_WindowsContainer (27.70s)

@bflad bflad merged commit 49f6654 into hashicorp:master Mar 15, 2019
bflad added a commit that referenced this pull request Mar 15, 2019
@bflad
Copy link
Contributor

bflad commented Mar 21, 2019

This has been released in version 2.3.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/codebuild Issues and PRs that pertain to the codebuild service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Cross-Account ECR Images for CodeBuild Environments
4 participants