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

Error: cache location is required when cache type is "S3" #71

Open
roffe opened this issue Mar 10, 2021 · 10 comments · Fixed by #80
Open

Error: cache location is required when cache type is "S3" #71

roffe opened this issue Mar 10, 2021 · 10 comments · Fixed by #80
Labels
bug 🐛 An issue with the system

Comments

@roffe
Copy link

roffe commented Mar 10, 2021

module "ecs-codepipeline" {
  source             = "cloudposse/ecs-codepipeline/aws"
  version            = "0.23.1"
  name               = "hello-world"
  namespace          = "eg"
  stage              = "staging"
  github_oauth_token = var.github_oauth_token
  region             = "eu-***-1"
  image_repo_name    = "hello-world"
  //github_webhooks_token = "xxxxxxxxxxxxxx"
  repo_owner       = "someowner"
  repo_name        = "ecs-hello-world"
  branch           = "master"
  service_name     = "hello-world"
  ecs_cluster_name = aws_ecs_cluster.lab-1.name
  privileged_mode  = "true"
}
Error: cache location is required when cache type is "S3"

  on .terraform/modules/ecs-codepipeline.codebuild/main.tf line 206, in resource "aws_codebuild_project" "default":
 206: resource "aws_codebuild_project" "default" {
 *
@inhumantsar
Copy link
Contributor

inhumantsar commented Aug 2, 2021

#80 does not fix this. This error should not have occurred even without the passthrough since the the bucket name should have defaulted to something valid.

The passthrough enabled a workaround but does not solve this issue.

@nitrocode nitrocode reopened this Aug 2, 2021
@nitrocode
Copy link
Member

When you set closes and then the issue number in the PR, when the PR is merged, github will auto close the issue linked. I've reopened it for now.

@nitrocode
Copy link
Member

Seems like this may be related hashicorp/terraform-provider-aws#10195

@inhumantsar
Copy link
Contributor

I'm not sure that issue is related. With the testing I did on cloudposse/terraform-aws-codebuild#91 the issue went away when I used a string, whether interpolated or directly. It was only when random_string or random_id got involved that the error would occur.

It's really strange. I would expect that if random_string failed, the result would be simply missing the suffix, like bucket-name-. In this situation though, it's like the entire interpolated string ends up converted into a null or something.

@nitrocode
Copy link
Member

What terraform versions are being used? The test uses 0.13 and I'm using 1.0 locally. Both seem to work as expected.

How can I reproduce the issue?

@nitrocode
Copy link
Member

Perhaps you could PR a terratest and if we can get a failing result then we can figure out how to update the module so the tests pass.

@inhumantsar
Copy link
Contributor

what version of hashicorp/random are you using?

❯ terraform --version
Terraform v1.0.1
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.52.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

i'm not sure where to even start with getting terratest to repro the issue. my best guess atm is that it's a platform thing. mac vs linux. but being that random and terraform are Go apps, i'm not sure it could be a platform thing.

@roffe @techies20 @pgbce @putarpuar @nilreml if you're also experiencing this issue, can you post your terraform --version output as well?

@nilreml
Copy link

nilreml commented Oct 8, 2021

terraform --version
Terraform v0.14.11
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws 3.54.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

@nk9
Copy link

nk9 commented Jan 21, 2022

I'm seeing this too.

$ terraform --version
Terraform v1.1.4
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.59.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0
│ Error: cache location is required when cache type is "S3"
│ 
│   with module.project_module.module.ecs_codepipeline.module.codebuild.aws_codebuild_project.default[0],
│   on .terraform/modules/project_module.ecs_codepipeline.codebuild/main.tf line 292, in resource "aws_codebuild_project" "default":
│  292: resource "aws_codebuild_project" "default" {
module "ecs_codepipeline" {
  source                = "cloudposse/ecs-codepipeline/aws"
  version               = "0.28.5"
  enabled               = true

  region                = var.region
  name                  = var.project_name_new
  namespace             = "eg"
  stage                 = "staging"
  github_oauth_token    = "/Prod/GITHUB_OAUTH_TOKEN"
  repo_owner            = var.repository_owner
  repo_name             = var.repository_name
  branch                = var.repository_branch
  service_name          = "api"
  image_repo_name       = var.ecr_repository_name
  ecs_cluster_name      = "${var.project_name}_cluster"
  privileged_mode       = true
}

@nk9
Copy link

nk9 commented Jan 21, 2022

And as noted in #80, an effective workaround is to set cache_bucket_suffix_enabled = false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
5 participants