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

Request cluster_id and service_name for a dbaas_logs_cluster resource… #446

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

vaxvms
Copy link
Contributor

@vaxvms vaxvms commented Jul 24, 2023

…/data

You can have more than one cluster_id per service_name

Description

Instead on blindly selecting the first cluster_id of a service_name in dbaas_logs_cluster resource and data, request the user to give it.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (improve existing resource(s) or datasource(s))
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A: make testacc TESTARGS="-run TestAccDataSourceXxxxYyyyZzzzz_basic"
  • Test B: make testacc TESTARGS="-run TestAccDataSourceXxxxYyyyZzzzz_basic"

Test Configuration:

  • Terraform version: terraform version: Terraform vx.y.z
  • Existing HCL configuration you used:
resource "" "" {
 xx = "yy"
 zz = "aa"
}

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or issues
  • I have added acceptance tests that prove my fix is effective or that my feature works
  • New and existing acceptance tests pass locally with my changes
  • I ran succesfully go mod vendor if I added or modify go.mod file

@vaxvms vaxvms force-pushed the master branch 2 times, most recently from bfdbc1f to e2a1edc Compare July 25, 2023 08:46
@scraly
Copy link
Collaborator

scraly commented Aug 28, 2023

The /dbaas/logs/{serviceName}/cluster API endpoint allow users to display the list of cluster IDs linked to the LDP:

263657007-1a7e9b7b-edf3-407f-96d0-385b214ffcad

So in Terraform, we should have the same behavior : display the list of cluster IDs with a given serviceName/LDP ID.

So, I think a prerequisite for this PR should be to add a dbaas_logs_clusters datasource that list all the existing cluster IDs.
And then, as the suer can have a clusterID with Terraform, then he or she can have a cluster details.

WDYT?

@vaxvms
Copy link
Contributor Author

vaxvms commented Aug 30, 2023

You're right, it's done

@vaxvms vaxvms force-pushed the master branch 2 times, most recently from aad1950 to 2873c1f Compare September 27, 2023 15:15
@rbeuque74 rbeuque74 self-assigned this Nov 22, 2023
@rbeuque74 rbeuque74 self-requested a review November 22, 2023 16:40
@vaxvms
Copy link
Contributor Author

vaxvms commented Nov 23, 2023

  • id of dbaas_logs_cluster is now a concatenation of service name and cluster id. It will break existing usage.
  • if cluster id isn't provided, the cluster_id of the default cluster is used

d.SetId(cluster_id)
log.Printf("[DEBUG] Will read dbaas logs cluster %s/%s", serviceName, clusterId)

d.SetId(clusterId)
Copy link
Member

@rbeuque74 rbeuque74 Dec 8, 2023

Choose a reason for hiding this comment

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

To stay aligned with the resource:

Suggested change
d.SetId(clusterId)
d.SetId(serviceName+"_"+clusterId)

Copy link
Member

@rbeuque74 rbeuque74 left a comment

Choose a reason for hiding this comment

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

Just this one comment, and we will be good :)

@rbeuque74 rbeuque74 merged commit d107fc2 into ovh:master Dec 13, 2023
@rbeuque74
Copy link
Member

Thanks for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants