_This issue was originally opened by @kaofelix as hashicorp/terraform#17019. It was migrated here as a result of the provider split. The original body of the issue is below._
AWS CodeBuild projects support caching of dependencies for a build. This allows a user to specify an S3 bucket and a path within that bucket that will be used as cache storage for paths specified in a section of the buildspec YAML file.
I've seen this introduced in this blog post, where it is shown how to configure a CodeBuild project with caching from the AWS dashboard. The example use case is about Maven dependencies, which is close to my team's use case, albeit for Gradle instead. Using caching would help speed up our build significantly and since we are using terraform to manage our pipeline, it would be great to be able to do it from there.
It would be helpful if theaws_codebuild_project resource supported cache configuration. Maybe something along the lines of:
resource "aws_codebuild_project" "foobar" {
[...]
cache {
# s3 is the only option at the moment other than no cache at all,
# but there's a dropdown for it, so it might expand
type = "s3"
location = "some-bucket"
path_prefix = "/some/path"
}
[...]
}
From the dashboard, it seems that it's only possible to add cache from a newly created project, but not adding it to an existing one when editing. However, boto3 seems to support configuring cache when calling update_project in an existing project, so I guess it should be possible programatically somehow. I'm not familiar with how this is implemented in Terraform as I didn't have time to look at the source yet.
I decided to give it a try and managed to code the feature in. I submitted a PR (#2860) for that.
This support has been merged into master via #2860 and will release with v1.14.0 of the AWS provider, likely later today. 🎉
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!
Most helpful comment
I decided to give it a try and managed to code the feature in. I submitted a PR (#2860) for that.