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

Add Lightsail load balancer resource #11405

Merged
merged 20 commits into from
Oct 20, 2022

Conversation

akonrath
Copy link
Contributor

@akonrath akonrath commented Dec 22, 2019

Community Note

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

Closes #11049

Release note for CHANGELOG:

New Resource: aws_lightsail_load_balancer (#11049)

Output from acceptance testing:

### Lightsail Domain
$ make testacc TESTARGS='-run=TestAccAWSLightsailDomain'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -count 1 -parallel 20 -run=TestAccAWSLightsailDomain -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSLightsailDomain_basic
=== PAUSE TestAccAWSLightsailDomain_basic
=== RUN   TestAccAWSLightsailDomain_disappears
=== PAUSE TestAccAWSLightsailDomain_disappears
=== CONT  TestAccAWSLightsailDomain_basic
=== CONT  TestAccAWSLightsailDomain_disappears
--- PASS: TestAccAWSLightsailDomain_disappears (16.19s)
--- PASS: TestAccAWSLightsailDomain_basic (18.94s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	18.997s
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/flatmap	0.018s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags	0.005s [no tests to run]


### Lightsail Instance
$ make testacc TESTARGS='-run=TestAccAWSLightsailInstance'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -count 1 -parallel 20 -run=TestAccAWSLightsailInstance -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSLightsailInstance_basic
=== PAUSE TestAccAWSLightsailInstance_basic
=== RUN   TestAccAWSLightsailInstance_Name
=== PAUSE TestAccAWSLightsailInstance_Name
=== RUN   TestAccAWSLightsailInstance_Tags
=== PAUSE TestAccAWSLightsailInstance_Tags
=== RUN   TestAccAWSLightsailInstance_disappear
=== PAUSE TestAccAWSLightsailInstance_disappear
=== CONT  TestAccAWSLightsailInstance_basic
=== CONT  TestAccAWSLightsailInstance_disappear
=== CONT  TestAccAWSLightsailInstance_Tags
=== CONT  TestAccAWSLightsailInstance_Name
--- PASS: TestAccAWSLightsailInstance_disappear (65.30s)
--- PASS: TestAccAWSLightsailInstance_Tags (69.11s)
--- PASS: TestAccAWSLightsailInstance_basic (86.16s)
--- PASS: TestAccAWSLightsailInstance_Name (111.70s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	111.753s
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/flatmap	0.022s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags	0.006s [no tests to run]

### Lightsail Load Balancer
$ make testacc TESTARGS='-run=TestAccAWSLightsailLoadBalancer'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -count 1 -parallel 20 -run=TestAccAWSLightsailLoadBalancer -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSLightsailLoadBalancer_basic
=== PAUSE TestAccAWSLightsailLoadBalancer_basic
=== RUN   TestAccAWSLightsailLoadBalancer_Name
=== PAUSE TestAccAWSLightsailLoadBalancer_Name
=== RUN   TestAccAWSLightsailLoadBalancer_Tags
=== PAUSE TestAccAWSLightsailLoadBalancer_Tags
=== RUN   TestAccAWSLightsailLoadBalancer_disappear
=== PAUSE TestAccAWSLightsailLoadBalancer_disappear
=== CONT  TestAccAWSLightsailLoadBalancer_basic
=== CONT  TestAccAWSLightsailLoadBalancer_disappear
=== CONT  TestAccAWSLightsailLoadBalancer_Tags
=== CONT  TestAccAWSLightsailLoadBalancer_Name
--- PASS: TestAccAWSLightsailLoadBalancer_basic (205.85s)
--- PASS: TestAccAWSLightsailLoadBalancer_disappear (225.25s)
--- PASS: TestAccAWSLightsailLoadBalancer_Tags (229.12s)
--- PASS: TestAccAWSLightsailLoadBalancer_Name (386.96s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	387.006s
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/flatmap	0.014s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags	0.045s [no tests to run]

### Lightsail Static IP
$ make testacc TESTARGS='-run=TestAccAWSLightsailStaticIp'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -count 1 -parallel 20 -run=TestAccAWSLightsailStaticIp -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSLightsailStaticIpAttachment_basic
=== PAUSE TestAccAWSLightsailStaticIpAttachment_basic
=== RUN   TestAccAWSLightsailStaticIpAttachment_disappears
=== PAUSE TestAccAWSLightsailStaticIpAttachment_disappears
=== RUN   TestAccAWSLightsailStaticIp_basic
=== PAUSE TestAccAWSLightsailStaticIp_basic
=== RUN   TestAccAWSLightsailStaticIp_disappears
=== PAUSE TestAccAWSLightsailStaticIp_disappears
=== CONT  TestAccAWSLightsailStaticIpAttachment_basic
=== CONT  TestAccAWSLightsailStaticIp_disappears
=== CONT  TestAccAWSLightsailStaticIp_basic
=== CONT  TestAccAWSLightsailStaticIpAttachment_disappears
--- PASS: TestAccAWSLightsailStaticIp_disappears (14.24s)
--- PASS: TestAccAWSLightsailStaticIp_basic (16.59s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_disappears (79.01s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_basic (80.18s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	80.218s
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/flatmap	0.021s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags	0.013s [no tests to run]

Hello,

This PR:

  • Adds Lightsail load balancer resource (tested provisioning locally with make build)
  • Adds Lightsail load balancer documentation (tested locally with make website)
  • Fixes typos in other Lightsail resources ('disapear' -> 'disappear')

Next Steps:

  • Add Lightsail resource to attach Lightsail load balancer to Lightsail instance
  • Add Lightsail resource to create Lightsail load balancer certificates

@akonrath akonrath requested a review from a team December 22, 2019 04:13
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XL Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. service/lightsail Issues and PRs that pertain to the lightsail service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Dec 22, 2019
@akonrath akonrath changed the title Added Lightsail load balancer resource Add Lightsail load balancer resource Dec 22, 2019
@ghost
Copy link

ghost commented Dec 22, 2019

I'm not sure how this will close #11403.

@akonrath
Copy link
Contributor Author

I'm not sure how this will close #11403.

Thank you for catching that - updated PR to reference the correct issue (#11049)

@bflad bflad added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 2, 2020
@teamterraform
Copy link

Notification of Recent and Upcoming Changes to Contributions

Thank you for this contribution! There have been a few recent development changes that affect this pull request. We apologize for the inconvenience, especially if there have been long review delays up until now. Please note that this is automated message from an unmonitored account. See the FAQ for additional information on the maintainer team and review prioritization.

If you are unable to complete these updates, please leave a comment for the community and maintainers so someone can potentially continue the work. The maintainers will encourage other contributors to use the existing contribution as the base for additional changes as appropriate. Otherwise, contributions that do not receive updated code or comments from the original contributor may be closed in the future so the maintainers can focus on active items.

For the most up to date information about Terraform AWS Provider development, see the Contributing Guide. Additional technical debt changes can be tracked with the technical-debt label on issues.

As part of updating a pull request with these changes, the most current unit testing and linting will run. These may report issues that were not previously reported.

Terraform 0.12 Syntax

Reference: #8950
Reference: #14417

Version 3 and later of the Terraform AWS Provider, which all existing contributions would potentially be added, only supports Terraform 0.12 and later. Certain syntax elements of Terraform 0.11 and earlier show deprecation warnings during runs with Terraform 0.12. Documentation and test configurations, such as those including deprecated string interpolations (some_attribute = "${aws_service_thing.example.id}") should be updated to the newer syntax (some_attribute = aws_service_thing.example.id). Contribution testing will automatically fail on older syntax in the near future. Please see the referenced issues for additional information.

Action Required: Terraform Plugin SDK Version 2

Reference: #14551

The Terraform AWS Provider has been upgraded to the latest version of the Terraform Plugin SDK. Generally, most changes to contributions should only involve updating Go import paths in source code files. Please see the referenced issue for additional information.

Action Required: Removal of website/aws.erb File

Reference: #14712

Any changes to the website/aws.erb file are no longer necessary and should be removed from this contribution to prevent merge issues in the near future when the file is removed from the repository. Please see the referenced issue for additional information.

Upcoming Change of Git Branch Naming

Reference: #14292

Development environments will need their upstream Git branch updated from master to main in the near future. Please see the referenced issue for additional information and scheduling.

Upcoming Change of GitHub Organization

Reference: #14715

This repository will be migrating from https://github.com/terraform-providers/terraform-provider-aws to https://github.com/hashicorp/terraform-provider-aws. No practitioner or developer action is anticipated and most GitHub functionality will automatically redirect to the new location. Go import paths including terraform-providers can remain for now. Please see the referenced issue for additional information and scheduling.

@ianrodrigues
Copy link

Hey @akonrath, are you able to finish this pull request? Do you need any help on it? I'd like to move Lightsail resources forward :)

@akonrath
Copy link
Contributor Author

Hi @ianrodrigues ! Thanks for commenting. Heh, my hope, too, was to get more Lightsail resources going as well! This PR has been sitting for quite some time and I've moved most of my time and effort over to the Azure provider. If you'd like to bring the existing work I put together in this PR back up to speed, you're more than welcome to contribute and I can help out as needed. Thanks!

Base automatically changed from master to main January 23, 2021 00:56
@breathingdust breathingdust requested a review from a team as a code owner January 23, 2021 00:56
@brittandeyoung
Copy link
Collaborator

Hello @akonrath, I would like to help make the required updates in order to move this pull request forward. Are you able to grant me access to your branch so that i am able to push new commits?

@brittandeyoung
Copy link
Collaborator

@akonrath I have opened a pull request to your branch with changes to get this pull request updated with the comments outlined in the comment from TeamTerraform. Please review when you get time.

Copy link
Collaborator

@brittandeyoung brittandeyoung left a comment

Choose a reason for hiding this comment

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

Please remove the changes to the aws/resource_aws_lightsail_domain_test.go file from the pull request.

There are merge conflicts and the spelling error has been since resolved in the main branch.

Action Required: Removal of website/aws.erb File
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. and removed size/XL Managed by automation to categorize the size of a PR. labels Feb 25, 2021
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. and removed size/XXL Managed by automation to categorize the size of a PR. labels Feb 27, 2021
Copy link
Collaborator

@DrFaust92 DrFaust92 left a comment

Choose a reason for hiding this comment

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

Some comments to get you started.

also please add a test case for path update.

}
}

func TestAccAWSLightsailLoadBalancer_disappear(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the feedback, this change will be implemented once the following pull request is merged by @akonrath akonrath#96

op := resp.Operations[0]
d.SetId(d.Get("name").(string))

stateConf := &resource.StateChangeConf{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the feedback, this change will be implemented once the following pull request is merged by @akonrath akonrath#96

}
return err
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

lb := resp.LoadBalancer

and reuse it for all others instead repeating it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the feedback, this change will be implemented once the following pull request is merged by @akonrath akonrath#96

{
Config: testAccAWSLightsailLoadBalancerConfig_basic(lightsailLoadBalancerName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAWSLightsailLoadBalancerExists("aws_lightsail_load_balancer.lightsail_load_balancer_test", &loadBalancer),
Copy link
Collaborator

Choose a reason for hiding this comment

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

extract aws_lightsail_load_balancer.lightsail_load_balancer_test to resourceName := "aws_lightsail_load_balancer.lightsail_load_balancer_test" instead of repeating.

it would be also best to use test instead of lightsail_load_balancer_test to be less verbose and more similar to other acceptance tests in the provider

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the feedback, this change will be implemented once the following pull request is merged by @akonrath akonrath#96


func TestAccAWSLightsailLoadBalancer_basic(t *testing.T) {
var loadBalancer lightsail.LoadBalancer
lightsailLoadBalancerName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt())
Copy link
Collaborator

Choose a reason for hiding this comment

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

better to rename to rName and use acctest.RandomWithPrefix("tf-acc-test") and make tests configs more generic

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the feedback, this change will be implemented once the following pull request is merged by @akonrath akonrath#96

})
}

func TestAccAWSLightsailLoadBalancer_Tags(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the feedback, this change will be implemented once the following pull request is merged by @akonrath akonrath#96

Brittan DeYoung added 5 commits March 2, 2021 10:45
* old reference to glue
* string reference oid
* waiter import
Feature: Path acctests added
@brittandeyoung
Copy link
Collaborator

@DrFaust92 Thank you for your feedback and detailed recommendations. (This will be my fist contribution to any terraform provider so the detail and examples provided really helped.) I plan on being a regular contributor to this provider starting with Lightsail (and reviving the many stale pull requests), to get all Lightsail resources and data sources implemented.

I have implemented all of your recommendations to the best of my knowledge (remember i'm new to this, so please feel free to let me know where I may have missed what you were recommending) in the following pull request akonrath#96. Once @akonrath approves the PR the changes will be updated in this pull request.

Looking forward to contributing in any way i can to this provider.

@brittandeyoung
Copy link
Collaborator

brittandeyoung commented Mar 2, 2021

comment showing the newly added test passing

HM-C02YD58NJG5J:terraform-provider-aws bdeyoung$ make testacc TESTARGS='-run=TestAccAWSLightsailLoadBalancer'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLightsailLoadBalancer -timeout 120m
=== RUN   TestAccAWSLightsailLoadBalancer_basic
=== PAUSE TestAccAWSLightsailLoadBalancer_basic
=== RUN   TestAccAWSLightsailLoadBalancer_Name
=== PAUSE TestAccAWSLightsailLoadBalancer_Name
=== RUN   TestAccAWSLightsailLoadBalancer_HealthCheckPath
=== PAUSE TestAccAWSLightsailLoadBalancer_HealthCheckPath
=== RUN   TestAccAWSLightsailLoadBalancer_Tags
=== PAUSE TestAccAWSLightsailLoadBalancer_Tags
=== RUN   TestAccAWSLightsailLoadBalancer_disappears
=== PAUSE TestAccAWSLightsailLoadBalancer_disappears
=== CONT  TestAccAWSLightsailLoadBalancer_basic
=== CONT  TestAccAWSLightsailLoadBalancer_Tags
=== CONT  TestAccAWSLightsailLoadBalancer_Name
=== CONT  TestAccAWSLightsailLoadBalancer_HealthCheckPath
=== CONT  TestAccAWSLightsailLoadBalancer_disappears
--- PASS: TestAccAWSLightsailLoadBalancer_disappears (139.88s)
--- PASS: TestAccAWSLightsailLoadBalancer_basic (167.32s)
--- PASS: TestAccAWSLightsailLoadBalancer_HealthCheckPath (177.74s)
--- PASS: TestAccAWSLightsailLoadBalancer_Tags (227.68s)
--- PASS: TestAccAWSLightsailLoadBalancer_Name (296.83s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       299.825s

@brittandeyoung
Copy link
Collaborator

@DrFaust92 The pull request with the changes has been merged. Please review as you have time.

My next steps is that I am currently working on a resource for aws_lightsail_load_balancer_attachment (I already have working code for this locally) which I will be submitting in a separate PR once this one is merged (Since I will need the resource in order to write proper tests).

Then I will be writing 2 additional resources in an additional PR. One to create a Load Balancer certificate, and one for attaching the certificate to the load balancer.

Is there a preference for the reviewer team to have many smaller PR requests (Split each new resource into its own PR)? or a few large PR requests (containing multiple new resources)?

Again thank you ahead of time for any feedback.

@brittandeyoung
Copy link
Collaborator

@DrFaust92 any chance I can get another review on this soon? This internal service waiter will be useful and needed for all of the other lightsail contributions I am wanting to make.

@brittandeyoung
Copy link
Collaborator

brittandeyoung commented Apr 12, 2021

Am I doing something incorrect in order to get another review? Or is this a standard wait time on a contribution? Sorry for the stupid question, I am newish to contributing to open source and just want to make sure I doing it correctly.

@brittandeyoung
Copy link
Collaborator

Any chance of getting another review on this PR?

@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

@brittandeyoung
Copy link
Collaborator

For Awareness I have begun work on creating a separate AWS lightsail provider in order to help with Speeding up contributions and to give it dedicated attention.

The Github repo is located here: https://github.com/DeYoungTech/terraform-provider-awslightsail

The provider and documentation is published here: https://registry.terraform.io/providers/DeYoungTech/awslightsail/latest

With the most recent version, the provider has moved past resource parity for lightsail services and It includes this resource.

If you want to start using this resource now, feel free to check it out and provide feedback.

@brittandeyoung
Copy link
Collaborator

@akonrath If I where to put in the time to make a Pull request against your branch to bring this change up to date, would you be available to merge it?

@github-actions
Copy link

This functionality has been released in v4.36.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 Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. service/lightsail Issues and PRs that pertain to the lightsail service. size/XL 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.

Add AWS Lightsail Load Balancer Support
8 participants