terraform-aws-ecs-codepipeline
terraform-aws-ecs-codepipeline copied to clipboard
Error: cache location is required when cache type is "S3"
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" {
*
#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.
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.
Seems like this may be related https://github.com/hashicorp/terraform-provider-aws/issues/10195
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.
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?
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.
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?
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
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
}
And as noted in #80, an effective workaround is to set cache_bucket_suffix_enabled = false.