Skip to content

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

@roffe

Description

@roffe
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" {
 *

Activity

added
bug🐛 An issue with the system
on Mar 10, 2021
inhumantsar

inhumantsar commented on Aug 2, 2021

@inhumantsar
Contributor

#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 commented on Aug 2, 2021

@nitrocode
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

nitrocode commented on Aug 2, 2021

@nitrocode
Member

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

inhumantsar

inhumantsar commented on Aug 2, 2021

@inhumantsar
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

nitrocode commented on Aug 2, 2021

@nitrocode
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

nitrocode commented on Aug 2, 2021

@nitrocode
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

inhumantsar commented on Aug 3, 2021

@inhumantsar
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

nilreml commented on Oct 8, 2021

@nilreml
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

nk9 commented on Jan 21, 2022

@nk9

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

nk9 commented on Jan 21, 2022

@nk9

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @inhumantsar@nk9@roffe@nitrocode@nilreml

      Issue actions

        Error: cache location is required when cache type is "S3" · Issue #71 · cloudposse/terraform-aws-ecs-codepipeline