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 linode_database_mysql_v2 resource #1701

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Dec 31, 2024

📝 Description

This pull request implements a new linode_database_mysql_v2 resource supporting the new Aiven-backed managed database clusters.

NOTE: This PR depends on and uses the design of #1680. Information on design decisions & caveats can be found in its description.

✔️ How to Test

The following test steps assume you have pulled down this PR locally and do not have your account configured for legacy DBaaS clusters.

Unit Testing

make unit-test

Integration Testing

make PKG_NAME=linode/databasemysqlv2 int-test
make PKG_NAME=linode/databaseaccesscontrols int-test

Manual Testing

  1. In a terraform-provider-linode sandbox environment (e.g. dx-devenv), apply the following configuration:
 resource "linode_database_mysql_v2" "test" {
  region = "us-mia"
  label = "tf-test"
  type = "g6-nanode-1"
  engine_id = "mysql/8"

  allow_list = ["10.0.0.2/32", "10.0.0.3/32"]
  cluster_size = 3

  updates = {
    hour_of_day = 2
    day_of_week = 3
    frequency = "weekly"
    duration = 4
  }
}

NOTE: Database creations should take ~15 minutes.

  1. Ensure the apply was successful and the database has been properly created in Cloud Manager.
  2. Re-apply the configuration and ensure no changes are proposed.
  3. Make arbitrary changes to the allow_list, cluster_size, type, and updates attributes.
  4. Re-apply the configuration.
  5. Ensure the apply was successful and the database has been properly updated in Cloud Manager.
  6. Re-apply the configuration and ensure no changes are proposed.
  7. Append the following to the end of your configuration to create a new database forked from the first database:
resource "linode_database_mysql_v2" "forked" {
  region = "us-mia"
  label = "tf-test-forked"
  type = "g6-nanode-1"
  engine_id = "mysql/8"

  source = linode_database_mysql_v2.test.id
}
  1. Re-apply the configuration and validate that a new forked database has been created in Cloud Manager.
  2. Re-apply the configuration and ensure no changes are proposed.
  3. Destroy the configuration and ensure all databases are deleted as expected.

@lgarber-akamai lgarber-akamai added new-feature for new features in the changelog. do-not-merge PRs that should not be merged until the commented issue is resolved labels Dec 31, 2024
@lgarber-akamai lgarber-akamai removed the do-not-merge PRs that should not be merged until the commented issue is resolved label Jan 13, 2025
@lgarber-akamai lgarber-akamai marked this pull request as ready for review January 13, 2025 19:58
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner January 13, 2025 19:58
@lgarber-akamai lgarber-akamai requested review from jriddle-linode and zliang-akamai and removed request for a team January 13, 2025 19:58
Copy link
Collaborator

@jriddle-linode jriddle-linode left a comment

Choose a reason for hiding this comment

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

LGTM working locally with all tests!

Copy link
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

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

Looks good and works well! There might be an intermittent failure, probably caused by the API/backend?
https://github.com/linode/terraform-provider-linode/actions/runs/12781955064/attempts/1

@lgarber-akamai
Copy link
Contributor Author

Looks good and works well! There might be an intermittent failure, probably caused by the API/backend? https://github.com/linode/terraform-provider-linode/actions/runs/12781955064/attempts/1

Nice catch! This seems like another case of events being marked as finished before the resource exits the updating status. I think we can address this by polling for status after polling for the event to finish

@lgarber-akamai
Copy link
Contributor Author

lgarber-akamai commented Jan 16, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature for new features in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants