Skip to content
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

Fix aws_lightsail_instance name validation #29903

Merged
merged 2 commits into from Mar 10, 2023
Merged

Fix aws_lightsail_instance name validation #29903

merged 2 commits into from Mar 10, 2023

Conversation

danielcotton
Copy link
Contributor

Description

This PR corrects the overzealous instance name validation in aws_lightsail_instance. Previously the first character of an instance name had to be alphabetic; but can now be alphanumeric. I've added a positive test case for an instance with a numeric first character, and a negative test case for an instance with a symbol first character.
Due to the removal of the amazon_linux Lightsail blueprint, I have also updated all aws_lightsail_instance acceptance tests to use the amazon_linux_2 blueprint.

Relations

Closes #29899

References

https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_CreateInstances.html - Note there is no requirement mentioned for instances to start with an alphabetic character

Output from Acceptance Testing

$ make testacc TESTS=TestAccLightsailInstance_name PKG=lightsail
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lightsail/... -v -count 1 -parallel 20 -run='TestAccLightsailInstance_name'  -timeout 180m
=== RUN   TestAccLightsailInstance_name
=== PAUSE TestAccLightsailInstance_name
=== CONT  TestAccLightsailInstance_name
--- PASS: TestAccLightsailInstance_name (246.28s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lightsail	249.652s
...

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added service/lightsail Issues and PRs that pertain to the lightsail service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. labels Mar 10, 2023
@bschaatsbergen
Copy link
Member

Could you please add a changelog entry to your PR :)

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. labels Mar 10, 2023
@github-actions
Copy link

Thank you for your contribution! 🚀

Please note that the CHANGELOG.md file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the Contributing Guide for additional pull request review items.

Remove any changes to the CHANGELOG.md file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.

@github-actions github-actions bot added size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. documentation Introduces or discusses updates to documentation. labels Mar 10, 2023
@danielcotton
Copy link
Contributor Author

Could you please add a changelog entry to your PR :)

Done & rebased :)

Thanks for the quick response!

@bschaatsbergen
Copy link
Member

Could you run the tests too and copy the output to the PR description please:

Similar to this PR description: #29224 (comment)

@danielcotton
Copy link
Contributor Author

I believe I already have? That's the ones under 'Output from Acceptance Testing', right?

@bschaatsbergen
Copy link
Member

I believe I already have? That's the ones under 'Output from Acceptance Testing', right?

My bad, phone didn't properly show it :)

Copy link
Member

@bschaatsbergen bschaatsbergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

 make testacc TESTS=TestAccLightsailInstance_name PKG=lightsail                                                            
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lightsail/... -v -count 1 -parallel 20 -run='TestAccLightsailInstance_name'  -timeout 180m
=== RUN   TestAccLightsailInstance_name
=== PAUSE TestAccLightsailInstance_name
=== CONT  TestAccLightsailInstance_name
--- PASS: TestAccLightsailInstance_name (188.56s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lightsail  188.642s

@bschaatsbergen
Copy link
Member

Thanks for your contribution 👌🏼 @danielcotton

@bschaatsbergen
Copy link
Member

I'll ask @ewbankkit to sign this off.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Mar 10, 2023
@ewbankkit ewbankkit self-assigned this Mar 10, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccLightsailInstance_name\|TestAccLightsailInstance_basic' PKG=lightsail ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lightsail/... -v -count 1 -parallel 3  -run=TestAccLightsailInstance_name\|TestAccLightsailInstance_basic -timeout 180m
=== RUN   TestAccLightsailInstance_basic
=== PAUSE TestAccLightsailInstance_basic
=== RUN   TestAccLightsailInstance_name
=== PAUSE TestAccLightsailInstance_name
=== CONT  TestAccLightsailInstance_basic
=== CONT  TestAccLightsailInstance_name
--- PASS: TestAccLightsailInstance_basic (54.17s)
--- PASS: TestAccLightsailInstance_name (151.66s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lightsail	157.834s

@ewbankkit
Copy link
Contributor

@danielcotton Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit f6506e2 into hashicorp:main Mar 10, 2023
39 checks passed
@github-actions github-actions bot added this to the v4.59.0 milestone Mar 10, 2023
@github-actions
Copy link

This functionality has been released in v4.59.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/lightsail Issues and PRs that pertain to the lightsail service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: aws_lightsail_instance incorrectly requires instances to start with an alphabetical character
3 participants