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

r/aws_lightsail_database: service/lightsail: new-resource #18663

Merged
merged 33 commits into from
Jul 5, 2022

Conversation

brittandeyoung
Copy link
Collaborator

@brittandeyoung brittandeyoung commented Apr 8, 2021

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

Release note for CHANGELOG:

aws_lightsail_database

Closes #8719

Output from acceptance testing:

$  make testacc TESTARGS='-run=TestAccAWSLightsailDatabase'==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLightsailDatabase -timeout 180m
=== RUN   TestAccAWSLightsailDatabase_basic
=== PAUSE TestAccAWSLightsailDatabase_basic
=== RUN   TestAccAWSLightsailDatabase_Name
=== PAUSE TestAccAWSLightsailDatabase_Name
=== RUN   TestAccAWSLightsailDatabase_MasterDatabaseName
=== PAUSE TestAccAWSLightsailDatabase_MasterDatabaseName
=== RUN   TestAccAWSLightsailDatabase_MasterUsername
=== PAUSE TestAccAWSLightsailDatabase_MasterUsername
=== RUN   TestAccAWSLightsailDatabase_PreferredBackupWindow
=== PAUSE TestAccAWSLightsailDatabase_PreferredBackupWindow
=== RUN   TestAccAWSLightsailDatabase_PreferredMaintenanceWindow
=== PAUSE TestAccAWSLightsailDatabase_PreferredMaintenanceWindow
=== RUN   TestAccAWSLightsailDatabase_PubliclyAccessible
=== PAUSE TestAccAWSLightsailDatabase_PubliclyAccessible
=== RUN   TestAccAWSLightsailDatabase_BackupRetentionEnabled
=== PAUSE TestAccAWSLightsailDatabase_BackupRetentionEnabled
=== RUN   TestAccAWSLightsailDatabase_FinalSnapshotName
=== PAUSE TestAccAWSLightsailDatabase_FinalSnapshotName
=== RUN   TestAccAWSLightsailDatabase_Tags
=== PAUSE TestAccAWSLightsailDatabase_Tags
=== RUN   TestAccAWSLightsailDatabase_disappears
=== PAUSE TestAccAWSLightsailDatabase_disappears
=== CONT  TestAccAWSLightsailDatabase_basic
=== CONT  TestAccAWSLightsailDatabase_PubliclyAccessible
=== CONT  TestAccAWSLightsailDatabase_MasterDatabaseName
=== CONT  TestAccAWSLightsailDatabase_MasterUsername
=== CONT  TestAccAWSLightsailDatabase_PreferredBackupWindow
=== CONT  TestAccAWSLightsailDatabase_Name
=== CONT  TestAccAWSLightsailDatabase_Tags
=== CONT  TestAccAWSLightsailDatabase_PreferredMaintenanceWindow
=== CONT  TestAccAWSLightsailDatabase_disappears
=== CONT  TestAccAWSLightsailDatabase_FinalSnapshotName
=== CONT  TestAccAWSLightsailDatabase_BackupRetentionEnabled
--- PASS: TestAccAWSLightsailDatabase_basic (915.25s)
--- PASS: TestAccAWSLightsailDatabase_disappears (974.34s)
--- PASS: TestAccAWSLightsailDatabase_PreferredBackupWindow (1167.53s)
--- PASS: TestAccAWSLightsailDatabase_PreferredMaintenanceWindow (1191.90s)
--- PASS: TestAccAWSLightsailDatabase_Name (1192.23s)
--- PASS: TestAccAWSLightsailDatabase_PubliclyAccessible (1238.14s)
--- PASS: TestAccAWSLightsailDatabase_BackupRetentionEnabled (1258.07s)
--- PASS: TestAccAWSLightsailDatabase_Tags (1265.95s)
--- PASS: TestAccAWSLightsailDatabase_FinalSnapshotName (1396.47s)
--- PASS: TestAccAWSLightsailDatabase_MasterDatabaseName (2099.43s)
--- PASS: TestAccAWSLightsailDatabase_MasterUsername (2122.94s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       2126.468s

This PR:

  • Adds the resource aws_lightsail_database
  • Adds internal waiter for general Lightsail Operations
  • Adds internal waiter for Lightsail Database Modifications
  • Adds internal waiter for Lightsail Database BackupRetention modifications

@brittandeyoung brittandeyoung requested a review from a team as a code owner April 8, 2021 16:00
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. 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. labels Apr 8, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 8, 2021
@brittandeyoung brittandeyoung changed the title service/lightsail: New Resource: aws_lightsail_database r/aws_lightsail_database: service/lightsail: New Resource Jun 11, 2021
@brittandeyoung brittandeyoung changed the title r/aws_lightsail_database: service/lightsail: New Resource r/aws_lightsail_database: service/lightsail: new-resource Jun 11, 2021
craiggenner and others added 3 commits August 4, 2021 10:45
ASG - correct min value on max_instance_lifetime in the docs
…orp#20701)

As shown in hashicorp#20493 the documentation does not accurately reflect the current observed behaviour of this provider. The docs say that metadata_options.http_endpoint is optional, but the provider gives an error if http_endpoint is omitted.
@breathingdust breathingdust added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 4, 2021
@github-actions github-actions bot added service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. size/XL Managed by automation to categorize the size of a PR. labels Sep 23, 2021
@brittandeyoung
Copy link
Collaborator Author

Updated from main in order to resolve new conflicts. Can I get approval to run the workflows?

@github-actions github-actions bot removed the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Sep 23, 2021
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

Hi @brittandeyoung thanks for this PR! Just dropping a couple additional comments for review

internal/service/lightsail/database.go Outdated Show resolved Hide resolved
internal/service/lightsail/database.go Outdated Show resolved Hide resolved
internal/service/lightsail/database.go Outdated Show resolved Hide resolved
internal/service/lightsail/wait.go Outdated Show resolved Hide resolved
internal/service/lightsail/wait.go Outdated Show resolved Hide resolved
internal/service/lightsail/wait.go Outdated Show resolved Hide resolved
internal/service/lightsail/wait.go Outdated Show resolved Hide resolved
internal/service/lightsail/wait.go Outdated Show resolved Hide resolved
internal/service/lightsail/database.go Show resolved Hide resolved
internal/service/lightsail/database.go Show resolved Hide resolved
- Amend resource to add CustomizeDiff: verify.SetTagsDiff
- Amend database waiter to return lightsail.GetRelationalDatabaseOutput
- Amend operation waiter to use lightsail package constants
- Amend database resource to remove duplicate logic now that database waiter returns database read output
@brittandeyoung
Copy link
Collaborator Author

@anGie44 I have implemented your recommendations for when you get time to look at this PR again.

@brittandeyoung
Copy link
Collaborator Author

Updated Acceptance test run:

➜ terraform-provider-aws (f-d-aws_lightsail_database) ✗ make testacc TESTARGS='-run=TestAccDatabase_' PKG_NAME=internal/service/lightsail 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lightsail/... -v -count 1 -parallel 20  -run=TestAccDatabase_ -timeout 180m
=== RUN   TestAccDatabase_basic
=== PAUSE TestAccDatabase_basic
=== RUN   TestAccDatabase_RelationalDatabaseName
=== PAUSE TestAccDatabase_RelationalDatabaseName
=== RUN   TestAccDatabase_MasterDatabaseName
=== PAUSE TestAccDatabase_MasterDatabaseName
=== RUN   TestAccDatabase_MasterUsername
=== PAUSE TestAccDatabase_MasterUsername
=== RUN   TestAccDatabase_MasterPassword
=== PAUSE TestAccDatabase_MasterPassword
=== RUN   TestAccDatabase_PreferredBackupWindow
=== PAUSE TestAccDatabase_PreferredBackupWindow
=== RUN   TestAccDatabase_PreferredMaintenanceWindow
=== PAUSE TestAccDatabase_PreferredMaintenanceWindow
=== RUN   TestAccDatabase_PubliclyAccessible
=== PAUSE TestAccDatabase_PubliclyAccessible
=== RUN   TestAccDatabase_BackupRetentionEnabled
=== PAUSE TestAccDatabase_BackupRetentionEnabled
=== RUN   TestAccDatabase_FinalSnapshotName
=== PAUSE TestAccDatabase_FinalSnapshotName
=== RUN   TestAccDatabase_Tags
=== PAUSE TestAccDatabase_Tags
=== RUN   TestAccDatabase_disappears
=== PAUSE TestAccDatabase_disappears
=== CONT  TestAccDatabase_basic
=== CONT  TestAccDatabase_PreferredMaintenanceWindow
=== CONT  TestAccDatabase_FinalSnapshotName
=== CONT  TestAccDatabase_disappears
=== CONT  TestAccDatabase_Tags
=== CONT  TestAccDatabase_MasterUsername
=== CONT  TestAccDatabase_PreferredBackupWindow
=== CONT  TestAccDatabase_MasterDatabaseName
=== CONT  TestAccDatabase_BackupRetentionEnabled
=== CONT  TestAccDatabase_MasterPassword
=== CONT  TestAccDatabase_PubliclyAccessible
=== CONT  TestAccDatabase_RelationalDatabaseName
--- PASS: TestAccDatabase_MasterPassword (93.24s)
--- PASS: TestAccDatabase_disappears (838.37s)
--- PASS: TestAccDatabase_PreferredMaintenanceWindow (1055.48s)
--- PASS: TestAccDatabase_FinalSnapshotName (1117.71s)
--- PASS: TestAccDatabase_Tags (1174.24s)
--- PASS: TestAccDatabase_basic (1178.49s)
--- PASS: TestAccDatabase_RelationalDatabaseName (1198.53s)
--- PASS: TestAccDatabase_PubliclyAccessible (1250.31s)
--- PASS: TestAccDatabase_BackupRetentionEnabled (1300.40s)
--- PASS: TestAccDatabase_PreferredBackupWindow (1313.75s)
--- PASS: TestAccDatabase_MasterUsername (2017.51s)
--- PASS: TestAccDatabase_MasterDatabaseName (2183.08s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lightsail  2187.006s

- Amend Config names to resolve semgrep errors
- Amend function name to remove AWS
- Amend tests to resolve semgrep issues
@brittandeyoung
Copy link
Collaborator Author

brittandeyoung commented Jun 10, 2022

Here is the latest acceptance test run:

➜ terraform-provider-aws (f-d-aws_lightsail_database) ✔ make testacc TESTARGS='-run=TestAccLightsailDatabase_' PKG_NAME=internal/service/lightsail 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lightsail/... -v -count 1 -parallel 20  -run=TestAccLightsailDatabase_ -timeout 180m
=== RUN   TestAccLightsailDatabase_basic
=== PAUSE TestAccLightsailDatabase_basic
=== RUN   TestAccLightsailDatabase_RelationalDatabaseName
=== PAUSE TestAccLightsailDatabase_RelationalDatabaseName
=== RUN   TestAccLightsailDatabase_MasterDatabaseName
=== PAUSE TestAccLightsailDatabase_MasterDatabaseName
=== RUN   TestAccLightsailDatabase_MasterUsername
=== PAUSE TestAccLightsailDatabase_MasterUsername
=== RUN   TestAccLightsailDatabase_MasterPassword
=== PAUSE TestAccLightsailDatabase_MasterPassword
=== RUN   TestAccLightsailDatabase_PreferredBackupWindow
=== PAUSE TestAccLightsailDatabase_PreferredBackupWindow
=== RUN   TestAccLightsailDatabase_PreferredMaintenanceWindow
=== PAUSE TestAccLightsailDatabase_PreferredMaintenanceWindow
=== RUN   TestAccLightsailDatabase_PubliclyAccessible
=== PAUSE TestAccLightsailDatabase_PubliclyAccessible
=== RUN   TestAccLightsailDatabase_BackupRetentionEnabled
=== PAUSE TestAccLightsailDatabase_BackupRetentionEnabled
=== RUN   TestAccLightsailDatabase_FinalSnapshotName
=== PAUSE TestAccLightsailDatabase_FinalSnapshotName
=== RUN   TestAccLightsailDatabase_Tags
=== PAUSE TestAccLightsailDatabase_Tags
=== RUN   TestAccLightsailDatabase_disappears
=== PAUSE TestAccLightsailDatabase_disappears
=== CONT  TestAccLightsailDatabase_basic
=== CONT  TestAccLightsailDatabase_PreferredMaintenanceWindow
=== CONT  TestAccLightsailDatabase_FinalSnapshotName
=== CONT  TestAccLightsailDatabase_disappears
=== CONT  TestAccLightsailDatabase_BackupRetentionEnabled
=== CONT  TestAccLightsailDatabase_PubliclyAccessible
=== CONT  TestAccLightsailDatabase_MasterDatabaseName
=== CONT  TestAccLightsailDatabase_PreferredBackupWindow
=== CONT  TestAccLightsailDatabase_Tags
=== CONT  TestAccLightsailDatabase_MasterPassword
=== CONT  TestAccLightsailDatabase_RelationalDatabaseName
=== CONT  TestAccLightsailDatabase_MasterUsername
--- PASS: TestAccLightsailDatabase_MasterPassword (36.75s)
--- PASS: TestAccLightsailDatabase_disappears (711.69s)
--- PASS: TestAccLightsailDatabase_BackupRetentionEnabled (934.51s)
--- PASS: TestAccLightsailDatabase_RelationalDatabaseName (974.12s)
--- PASS: TestAccLightsailDatabase_PreferredMaintenanceWindow (1002.00s)
--- PASS: TestAccLightsailDatabase_Tags (1028.52s)
--- PASS: TestAccLightsailDatabase_PubliclyAccessible (1028.52s)
--- PASS: TestAccLightsailDatabase_basic (1037.85s)
--- PASS: TestAccLightsailDatabase_FinalSnapshotName (1121.24s)
--- PASS: TestAccLightsailDatabase_PreferredBackupWindow (1185.93s)
--- PASS: TestAccLightsailDatabase_MasterDatabaseName (2005.85s)
--- PASS: TestAccLightsailDatabase_MasterUsername (2121.76s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lightsail  2125.253s

- Amend to resolve semgrep function naming issues.
Copy link
Collaborator

@drewmullen drewmullen left a comment

Choose a reason for hiding this comment

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

This looks good to me. the only change imo is moving the consts.go content to database.go. convention post-reorg from everything in aws/ to service named directories we now put consts "as close to the code as possible"

Ik some changes have been happening to the semgrep functions also, once you push another commit the errors may resolve themselves. otherwise, you may have to update your test function names

@brittandeyoung
Copy link
Collaborator Author

@drewmullen I can make that update, but where would you suggest the ResTags const go then? as this constant applies to all lightsail resources?

I am working on pulling in the latest changes from main and running the semgrep tests locally to see if i get the same results.

@brittandeyoung
Copy link
Collaborator Author

Looks like the function names needed to use camel case. Updated the functions and moved the constants as recommended.

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=TestAccLightsailDatabase_' PKG=lightsail ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lightsail/... -v -count 1 -parallel 2  -run=TestAccLightsailDatabase_ -timeout 180m
=== RUN   TestAccLightsailDatabase_basic
=== PAUSE TestAccLightsailDatabase_basic
=== RUN   TestAccLightsailDatabase_RelationalDatabaseName
=== PAUSE TestAccLightsailDatabase_RelationalDatabaseName
=== RUN   TestAccLightsailDatabase_MasterDatabaseName
=== PAUSE TestAccLightsailDatabase_MasterDatabaseName
=== RUN   TestAccLightsailDatabase_MasterUsername
=== PAUSE TestAccLightsailDatabase_MasterUsername
=== RUN   TestAccLightsailDatabase_MasterPassword
=== PAUSE TestAccLightsailDatabase_MasterPassword
=== RUN   TestAccLightsailDatabase_PreferredBackupWindow
=== PAUSE TestAccLightsailDatabase_PreferredBackupWindow
=== RUN   TestAccLightsailDatabase_PreferredMaintenanceWindow
=== PAUSE TestAccLightsailDatabase_PreferredMaintenanceWindow
=== RUN   TestAccLightsailDatabase_PubliclyAccessible
=== PAUSE TestAccLightsailDatabase_PubliclyAccessible
=== RUN   TestAccLightsailDatabase_BackupRetentionEnabled
=== PAUSE TestAccLightsailDatabase_BackupRetentionEnabled
=== RUN   TestAccLightsailDatabase_FinalSnapshotName
=== PAUSE TestAccLightsailDatabase_FinalSnapshotName
=== RUN   TestAccLightsailDatabase_Tags
=== PAUSE TestAccLightsailDatabase_Tags
=== RUN   TestAccLightsailDatabase_disappears
=== PAUSE TestAccLightsailDatabase_disappears
=== CONT  TestAccLightsailDatabase_basic
=== CONT  TestAccLightsailDatabase_PreferredMaintenanceWindow
--- PASS: TestAccLightsailDatabase_basic (968.62s)
=== CONT  TestAccLightsailDatabase_FinalSnapshotName
--- PASS: TestAccLightsailDatabase_PreferredMaintenanceWindow (1175.99s)
=== CONT  TestAccLightsailDatabase_disappears
--- PASS: TestAccLightsailDatabase_disappears (619.36s)
=== CONT  TestAccLightsailDatabase_Tags
--- PASS: TestAccLightsailDatabase_FinalSnapshotName (1207.44s)
=== CONT  TestAccLightsailDatabase_MasterUsername
--- PASS: TestAccLightsailDatabase_Tags (1101.79s)
=== CONT  TestAccLightsailDatabase_PreferredBackupWindow
--- PASS: TestAccLightsailDatabase_PreferredBackupWindow (950.15s)
=== CONT  TestAccLightsailDatabase_MasterPassword
--- PASS: TestAccLightsailDatabase_MasterPassword (2.73s)
=== CONT  TestAccLightsailDatabase_BackupRetentionEnabled
--- PASS: TestAccLightsailDatabase_MasterUsername (2112.76s)
=== CONT  TestAccLightsailDatabase_MasterDatabaseName
--- PASS: TestAccLightsailDatabase_BackupRetentionEnabled (1107.22s)
=== CONT  TestAccLightsailDatabase_RelationalDatabaseName
--- PASS: TestAccLightsailDatabase_RelationalDatabaseName (991.80s)
=== CONT  TestAccLightsailDatabase_PubliclyAccessible
--- PASS: TestAccLightsailDatabase_MasterDatabaseName (1783.68s)
--- PASS: TestAccLightsailDatabase_PubliclyAccessible (1033.54s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lightsail	6986.815s

@ewbankkit
Copy link
Contributor

@brittandeyoung Thanks for the contribution 🎉 👏.

@ewbankkit
Copy link
Contributor

% make providerlint
==> Checking source code with providerlint...

@ewbankkit ewbankkit merged commit 180eb74 into hashicorp:main Jul 5, 2022
@github-actions github-actions bot added this to the v4.22.0 milestone Jul 5, 2022
@github-actions
Copy link

github-actions bot commented Jul 8, 2022

This functionality has been released in v4.22.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

github-actions bot commented Aug 7, 2022

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 Aug 7, 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. size/XXL 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 Amazon Lightsail Managed Databases Support
10 participants