terraform-aws-gitlab-runner icon indicating copy to clipboard operation
terraform-aws-gitlab-runner copied to clipboard

cache: environment is not included as bucket name prefix

Open ashanbrown opened this issue 2 years ago • 4 comments

The docs describe the environment variable as:

A name that identifies the environment, used as prefix and for tagging.

However, environment appears to only be used for tags and is not included in the prefix (see https://github.com/npalm/terraform-aws-gitlab-runner/blob/5.0.2/modules/cache/main.tf#L15.). Am I right in thinking the intent was to include this in the prefix?

ashanbrown avatar Jun 13 '22 17:06 ashanbrown

Seems that there is a cache_bucket_prefix which is used for the caches. So I think this is correct.

By the way: I have multiple Agents running but deployed the cache module only once. Is there a benefit having multiple cache buckets?

kayman-mk avatar Jun 16 '22 19:06 kayman-mk

Any news here @ashanbrown ?

kayman-mk avatar Aug 06 '22 07:08 kayman-mk

If the environment is not included in the prefix, then the s3 buckets will collide if a shared bucket is not used. I was thinking that if the user chooses not to use a shared bucket but to have multiple environments, it should "just work."

I agree that a shared bucket is probably a good practice but for lifecycle reasons, it might be useful to spin up and tear down environments independently.

ashanbrown avatar Aug 13 '22 15:08 ashanbrown

Good point. The documentation of environment says A name that identifies the environment, used as prefix and for tagging.

Well, in this case it wasn't used as prefix. So the code is wrong.

By the way: We introduced a resource_prefix variable in our own Terraform code. Just to make clear that every resource has to be prefixed with this value.

kayman-mk avatar Aug 13 '22 21:08 kayman-mk