Allow setting the full name of the S3 bucket #47
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This allows to respect the var.source_bucket_name as full bucket name instead of just the prefix.
This addresses #46 and does it in a backwards compatible way.
Motivation
When setting var.source_bucket_name, it turns out that it's only setting the bucket name prefix (see here) and not the actual name of the bucket. I'm not sure why the behavior is different given the variable's name and description. The other name variables, var.name and var.iam_role_name, are respected and passed through as the names for those resources, so I'm not sure why it's inconsistent for the s3 bucket.
More
pre-commit run -a
with this PRFor Moderators
Additional Notes
There are 3 cases to consider for the name of the s3 bucket:
var.source_bucket_name == null
, the value ofvar.use_source_bucket_name_as_prefix
does not matter. In this case, we default to the original behavior of setting the default name prefix for the bucket.var.source_bucket_name != null
andvar.use_source_bucket_name_as_prefix == true
. In this case, the original module behavior of settingvar.source_bucket_name
as the bucket name prefix.var.source_bucket_name != null
andvar.use_source_bucket_name_as_prefix == false
. In this case, the new behavior is to set the full bucket name asvar.source_bucket_name
.