Skip to content

Commit

Permalink
Incorporate reviewer feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru committed Aug 20, 2021
1 parent b5614df commit 0297a52
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
11 changes: 8 additions & 3 deletions descriptors.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Unfortunately, cannot easily use plain format string
# It would be nice to have a fixed array of arguments passed into
# `format()` so all you need to provide is a format string, but
# unfortunately, that does not work easily
# due to https://github.com/hashicorp/terraform/issues/28558
# Could hack around it by adding then removing a trailing arg, like
# which requires that the format string consume the last argument passed in.
# We could hack around it by adding then removing a trailing arg, like
#
# trimsuffix(format("${var.format_string}%[${length(local.labels)+1}]v", concat(local.labels, ["x"])...), "x")
#
# but that is kind of a hack, and overlooks the fact that local.labels
# drops empty label elements, so the index of an element is not guaranteed.
#

#
# So we require the user to specify the arguments as well as the format string.
#

# There is a lot of room for enhancement, but since this is a new feature
# with only 2 use cases, we are going to keep it simple for now.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module "source_v24_empty" {
stage = "STAGE"
}

# To test backward compatibility of supplying an new
# When testing the backward compatibility of supplying a new
# context to an old module, it is not fair to use
# the new features in the new module.
module "source_v25_22_full" {
Expand All @@ -97,7 +97,11 @@ module "source_v25_22_full" {
additional_tag_map = {
propagate = true
}
label_order = ["name", "environment", "stage", "attributes"]
label_order = ["name", "environment", "stage", "attributes"]
# Need to add "+" to the regex in v0.22.1 due to a known issue:
# the attributes string will have the delimiter stripped out
# if the delimiter is selected by `regex_replace_chars`.
# This was fixed in v0.24.1
regex_replace_chars = "/[^a-tv-zA-Z0-9+]/" # Eliminate "u" just to verify this is taking effect
id_length_limit = 28
}
Expand Down Expand Up @@ -268,7 +272,7 @@ output "compare_25_24_empty" {
}


output "compatable" {
output "compatible" {
value = (
module.compare_22_25_full.equal &&
module.compare_24_25_full.equal &&
Expand Down
4 changes: 2 additions & 2 deletions test/src/examples_complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func TestExamplesComplete(t *testing.T) {
// This will run `terraform init` and `terraform apply` and fail the test if there are any errors
terraform.InitAndApply(t, terraformOptions)

compatable := terraform.Output(t, terraformOptions, "compatable")
assert.Equal(t, "true", compatable)
compatible := terraform.Output(t, terraformOptions, "compatible")
assert.Equal(t, "true", compatible)

descriptorAccountName := terraform.Output(t, terraformOptions, "descriptor_account_name")
descriptorStack := terraform.Output(t, terraformOptions, "descriptor_stack")
Expand Down

0 comments on commit 0297a52

Please sign in to comment.