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

Adding support for nomad variables #325

Merged
merged 9 commits into from
Jun 5, 2023
Merged

Conversation

regner
Copy link
Contributor

@regner regner commented May 4, 2023

This PR is based on #304. The original author, iluminae, of that PR is unable to continue their work.

Please note that I have not done Terraform provider work before, and very little Go work, so if some choices or questions don't make sense, that's probably why.

I have tried to implement the feedback that @lgfa29 had on the original PR. I did however only add a single test, I wanted to make sure I was on the write path before continuing.

iluminae and others added 2 commits May 4, 2023 12:06
Work based on feedback of the original PR for variables.

* Added more descriptions and updated a few existing ones
* Added validation for the path attribute
* Reworked a bit of the implementations, made them more closely resemble other implementations (such as acl_auth_method) for consistency
* First pass adding a test
@hashicorp-cla
Copy link

hashicorp-cla commented May 4, 2023

CLA assistant check
All committers have signed the CLA.

@regner regner marked this pull request as ready for review May 5, 2023 08:51
@regner
Copy link
Contributor Author

regner commented May 22, 2023

@lgfa29 sorry for the ping, wasn't sure who else to poke, would you be able to help move this PR forward?

* Adjusting error formats to conform to standards
* Fixed the resource read so it works for the data_variable
* Removed redundant return
@regner
Copy link
Contributor Author

regner commented May 23, 2023

I am unsure how best to handle the path changing. That requires deleting the old resource and creating a new one.

@mikenomitch
Copy link

Hey @regner, I just came across this PR and realize it hasn't gotten a reply yet! Sorry!

I'll make sure we have somebody take a look next week.

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

Looking good @regner, thanks for picking-up the work from @iluminae.

I left a few more notes here, and would you be able to write some documentation as well? They live inside the website forlder. Unfortunately the local doc preview flow is not working anymore, but you can use this website for now: https://registry.terraform.io/tools/doc-preview

Let me know if you have any questions 🙂

nomad/resource_variable.go Outdated Show resolved Hide resolved
nomad/resource_variable.go Show resolved Hide resolved
nomad/resource_variable.go Outdated Show resolved Hide resolved
nomad/resource_variable.go Outdated Show resolved Hide resolved
nomad/resource_variable.go Outdated Show resolved Hide resolved
nomad/resource_variable_test.go Outdated Show resolved Hide resolved
* Fixed some typos
* Added test for path name changing
* Now return multiple errors at once instead of only one error when validating variable path
@regner
Copy link
Contributor Author

regner commented Jun 3, 2023

Thank you very much for the comments. I have updated everything but the docs, which I will work on now.

@regner
Copy link
Contributor Author

regner commented Jun 3, 2023

@lgfa29 I have now added the docs. I think it's ready for another review when you have time. Thank you very much for your time and help with this.

@regner
Copy link
Contributor Author

regner commented Jun 4, 2023

Just realized the tests need a min version check for variables.

@regner
Copy link
Contributor Author

regner commented Jun 5, 2023

Is there a way to run a specific test or do I need to always run all the tests?

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

Thank you for the fixes @regner!

I noticed some other things I didn't notice in the first review (like namespace needing to be ForceNew as well) and others mistake I made with the error handling where some errors ended up being ignore. I pushed 2a9a0c0 to fix those and some other minor things. Hopefully I didn't break anything else 😅

@lgfa29
Copy link
Contributor

lgfa29 commented Jun 5, 2023

Is there a way to run a specific test or do I need to always run all the tests?

For this I usually run the go test command by hand, like

TF_ACC=1 go test -count 1 -v -run TestResourceVariable ./nomad

@lgfa29 lgfa29 merged commit 7a71f53 into hashicorp:main Jun 5, 2023
1 check passed
@regner regner deleted the nomad-variables branch June 5, 2023 23:01
@regner
Copy link
Contributor Author

regner commented Jun 5, 2023

Thank you very much for your help and time with this PR. I learned a bunch.

@lgfa29 lgfa29 added this to the 2.0.0 milestone Aug 15, 2023
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.

None yet

5 participants