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

feat: Add gitlab_repository_file data source #939

Merged
merged 3 commits into from Mar 20, 2022

Conversation

petrmvala
Copy link
Contributor

This data source is part of Gitlab API.

Closes: #927

Description

PR Checklist Acknowledgement

  • I acknowledge that all of the following items are true, where applicable:
    • Resource attributes match 1:1 the names and structure of the API resource in the GitLab API documentation.
    • Examples are updated with:
      • A *.tf file for the resource/s with at least one usage example
      • A *.sh file for the resource/s with an import example (if applicable)
    • New resources have at minimum a basic test with three steps:
      • Create the resource
      • Update the attributes
      • Import the resource
    • No new //lintignore comments were copied from existing code. (Linter rules are meant to be enforced on new code.)

Copy link
Member

@timofurrer timofurrer left a comment

Choose a reason for hiding this comment

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

Could you give this approach a shot:

https://github.com/gitlabhq/terraform-provider-gitlab/blob/main/internal/provider/data_source_gitlab_project_issue.go

For that to work you may also add the additional read-only fields to the gitlab_repository_file resource as Computed.

If you don't want I can later or tomorrow give it a shot, no worries.

Also, the examples are missing ;)

@petrmvala
Copy link
Contributor Author

Well, I posted this because I was not sure why does this error out and wanted to ask for advice https://github.com/gitlabhq/terraform-provider-gitlab/runs/5461795214?check_suite_focus=true#step:6:34

But the approach with the schema seems interesting.

@timofurrer
Copy link
Member

@petrmvala It's unrelated, but probably related to #820 ...

Copy link
Member

@timofurrer timofurrer 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, I think we leave the things with datasourceSchemaFromResourceSchema() for now and go with the proposed approach.

This data source is part of Gitlab API.

Closes: #927
@timofurrer timofurrer force-pushed the feat/repository-file-datasource branch 2 times, most recently from 46ad9fb to 750cfde Compare March 19, 2022 15:45
@timofurrer timofurrer force-pushed the feat/repository-file-datasource branch from 750cfde to c1e131f Compare March 19, 2022 15:48
@timofurrer
Copy link
Member

@petrmvala I took the liberty and followed up on this.

I'll merge once the checks passed!

Thank you very much for the contribution! 🎉

@timofurrer timofurrer self-assigned this Mar 19, 2022
@timofurrer timofurrer added this to the v3.13.0 milestone Mar 19, 2022
@github-actions github-actions bot added resource Adds or modifies a resource size/L and removed size/M labels Mar 19, 2022
@timofurrer timofurrer merged commit feefdf6 into gitlabhq:main Mar 20, 2022
@github-actions
Copy link

This functionality has been released in v3.13.0 of the Terraform GitLab 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. Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
data-source Adds or modifies a data-source documentation provider resource Adds or modifies a resource size/L tests
2 participants