New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider/aws: Allow aws_alb
to have the name auto-generated
#8673
Conversation
LGTM – should probably add name_prefix in there while we're at it |
aws_alb
to have the name auto-generatedaws_alb
to have the name auto-generated
38bf96d
to
8bc428c
Compare
aws_alb
to have the name auto-generatedaws_alb
to have the name auto-generated
@catsby added :) |
testAccCheckAWSALBExists("aws_alb.alb_test", &conf), | ||
resource.TestCheckResourceAttrSet("aws_alb.alb_test", "name"), | ||
resource.TestMatchResourceAttr("aws_alb.alb_test", "name", | ||
regexp.MustCompile("^tf-lb+")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is basically working, but the +
quantifier at the end doesn't make much sense as it belongs to b
.
I assume "^tf-lb.+"
is what you intended to type here? Perhaps "^tf-lb"
would be sufficient and less greedy.
In order to satisify scenarios where a lifecycle is block is used, we would need the AWS ALB name field to be autogenerated. WE follow the same work as AWS ELB, we prefix it with `tl-lb-` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSALB_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/09/08 12:43:40 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSALB_ -timeout 120m === RUN TestAccAWSALB_basic --- PASS: TestAccAWSALB_basic (79.81s) === RUN TestAccAWSALB_generatedName --- PASS: TestAccAWSALB_generatedName (93.81s) === RUN TestAccAWSALB_namePrefix --- PASS: TestAccAWSALB_namePrefix (73.48s) === RUN TestAccAWSALB_tags --- PASS: TestAccAWSALB_tags (181.32s) === RUN TestAccAWSALB_noSecurityGroup --- PASS: TestAccAWSALB_noSecurityGroup (66.03s) === RUN TestAccAWSALB_accesslogs --- PASS: TestAccAWSALB_accesslogs (130.82s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 625.285s ```
8bc428c
to
20ad3e0
Compare
Hi @radeksimko I have made the change as requested - the new test results:
|
@stack72 thanks for making the change to allow name to be optional so create_before_destroy can be used. Unfortunately this is still not usable. Using name_prefix and create_before_destroy makes the auto-generated name (including the prefix) over 32 chars, which results in an error from Terraform. Can you guys cut the length of the auto-generated portion in half so name_prefix can be used? Or better yet, adjust the length of the auto-generated name based on the length of name_prefix so the final name is under 32 chars? |
Hi @levinse Can you post what you autogenerated name is? When i don't specify a name i definitely have less than 32 characters P. |
@stack72 I don't have access to the test environment now but if you use name_prefix of e.g. 10 chars the full string with the prefix was over 40 chars. I'll try to post the specifics later but it should be easy to repro. |
Hi @stack72 any updates on this? Thanks |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
In order to satisify scenarios where a lifecycle is block is used, we
would need the AWS ALB name field to be autogenerated. We follow the
same work as AWS ELB, we allow either a name-prefix or we automatically assign a prefix of
tf-lb