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

chore: Generate datasources based on OpenAPI specification #613

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

moduli
Copy link
Contributor

@moduli moduli commented May 9, 2024

NOTE: WIP

This PR is a continuation of the work started here: #127

A new make target (make data-sources) was added to automatically generate data sources for the terraform provider. This target was also added to make gen to ensure that the desired changes are present.

Data sources are generated by processing Boundary's OpenAPI spec (it determines the version of the spec based on the boundary version specified in this repo's go.mod file).

Usage

# This generates data-sources files 
# This also generates examples that can be used when performing `make docs`
# Note: tests are created independently of this script
# Note: you have to manually update `provider.go` to include the new data sources
make data-sources

...

To Do

  • Rebase original PR and address issues
  • Automatically generate for all resources
  • Add to make gen delta
  • Review and fix tests added from original PR
  • Check if lookup id field should not be set to "Optional"
  • Add tests for new data sources that were created
  • Generate examples for use in docs
  • Do some data sources not make sense? auth tokens, sessions. should we skip creating those?
  • Manual testing

Maybe scope out the singular variant for now?

  • Figure out if we also want to include "singular" variants (i.e. data "boundary_auth_method" v.s. data "boundary_auth_methods")
    • resolve issues in the current "singular" template
    • fix logic: aliases, credential_libraries, policies - singular doesn’t make sense if you just remove s

@moduli moduli force-pushed the moduli-generate-datasources branch 6 times, most recently from 5f62a09 to 5feb16f Compare May 10, 2024 16:31
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The schema here is going to make documentation a little tricky since not all of this information is returned in a LIST response...

@moduli moduli force-pushed the moduli-generate-datasources branch from 5feb16f to 97dd7f8 Compare June 6, 2024 16:41
@moduli moduli force-pushed the moduli-generate-datasources branch 3 times, most recently from 9dab55f to 2e82e5c Compare July 12, 2024 20:43
moduli and others added 4 commits July 12, 2024 17:18
Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
This check ensures that data sources are up-to-date with the boundary version used in the repo
@moduli moduli force-pushed the moduli-generate-datasources branch from 2e82e5c to 484fe42 Compare July 12, 2024 21:18
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.

1 participant