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

aws_codebuild_project: cache config does not stick when cache type set to "NO_CACHE" #4113

Closed
ebarault opened this issue Apr 8, 2018 · 8 comments · Fixed by #4134
Closed
Labels
bug Addresses a defect in current functionality. service/codebuild Issues and PRs that pertain to the codebuild service.
Milestone

Comments

@ebarault
Copy link

ebarault commented Apr 8, 2018

I've been trying to build a aws_codebuild_project module where cache can be enabled/disabled conditionally.

Although not officially documented, cache.type can be set to NO_CACHE, which rather intuitively made me thing i could use this value to indicate cache should not be enabled, just like the artifacts.type = NO_ARTIFACTS config, which it does.

The caveat is that this value does not stick and reapplying the module causes terraform to plan modifications on this value over and over.

Terraform Version

0.11.6

AWS provider version

1.14.0

Affected Resource(s)

aws_codebuild_project

Terraform Configuration Files

resource "aws_codebuild_project" "codebuild_project" {
  # ...
  cache {
    type = "NO_CACHE"
    location = ""
  }
}

Expected Behavior

Once applied, a new terraform apply should not trigger any modification

Actual Behavior

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ aws_codebuild_project.codebuild_project
      cache.0.type: "" => "NO_CACHE"

Reference:

I traced the discussion here
https://github.com/terraform-providers/terraform-provider-aws/pull/2860/files#r160149934

and while i get the rationale that drove to this behavior, I do think the NO_CACHE value should be available to users in a way that would stick, so that modules could conditionally enable caching, just like it's already possible to do with artifacts, using type = NO_ARTIFACTS.

Also, when cache.type is set to NO_CACHE, it should be possible not to define cache.location.

cc: @kaofelix, @bflad

@catsby catsby added service/codebuild Issues and PRs that pertain to the codebuild service. bug Addresses a defect in current functionality. labels Apr 9, 2018
@catsby
Copy link
Contributor

catsby commented Apr 9, 2018

Hey! I agree with your thoughts there, I think NO_CACHE should be valid. Another example usage is a system that was using cache but no longer wants to... with cache being optional and computed, removing the attribute from configuration will not then make the cache become disabled, it just won't be tracked anymore (if I read the code correctly).

@ebarault
Copy link
Author

ebarault commented Apr 9, 2018

yes, you have a good example too. The discussion in there points this out, if i read correctly too

@catsby
Copy link
Contributor

catsby commented Apr 9, 2018

Unfortunately I'm not sure the Terraform team will be able to address this in the near future, but I've added a comment to #2860 (comment) explaining what we've found here, hopefully someone can pick it up!

From what I can tell, we need to apply a default of NO_CACHE here for cache.

@bflad
Copy link
Contributor

bflad commented Apr 9, 2018

Followup PR submitted: #4134

@bflad bflad added this to the v1.14.1 milestone Apr 9, 2018
@bflad
Copy link
Contributor

bflad commented Apr 11, 2018

The fix for this has been merged into master and will release with v1.14.1 of the AWS provider, likely later today.

@bflad
Copy link
Contributor

bflad commented Apr 11, 2018

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

@ebarault
Copy link
Author

@bflad : just tested this. It works like a charm. Many thanks for fixing this so quickly. 👍

@ghost
Copy link

ghost commented Apr 6, 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 Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/codebuild Issues and PRs that pertain to the codebuild service.
Projects
None yet
3 participants