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 post to http data source #13169

Closed
hegerdes opened this issue Sep 23, 2024 · 3 comments · Fixed by #13190
Closed

feat: add post to http data source #13169

hegerdes opened this issue Sep 23, 2024 · 3 comments · Fixed by #13190

Comments

@hegerdes
Copy link
Contributor

hegerdes commented Sep 23, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.

Description

Acording the docs and code the packer http datasoruce only supports GET while the Terraform datasouce supports multiple HTTP methods. Since it is mostly just copied it should be feature equivalent. During the build users may want to get data based on inputs. Most APIs require the data to be in the body so a POST/PUT is needed or recommended.

Use Case(s)

  • Query data from a remote API based on inputs
  • Send packer build artifacts (checksums, sboms...) to an artifact store
  • Configure packer created services via a POST request
  • Check if the packer created resources was successfully created or is healthy
  • Send information to a communication channel via a webhook

Potential configuration

data "http" "example_post" {
  url    = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
  method = "POST"

  # Optional request body
  request_body = "request body"
}

Potential References

@lbajolet-hashicorp
Copy link
Contributor

Hi @hegerdes,

This is a good idea! We can look into this, I can't promise when we'll get around to it though sorry.

If you want to please also feel free to look into implementing this and send a PR our way, we'll gladly review it, and if you need help on that, don't hesitate to reach-out!

hegerdes added a commit to hegerdes/hashicorp-packer that referenced this issue Oct 19, 2024
This adds support for additional http methods for the http datasource.
Fixes hashicorp#13169

Signed-off-by: Henrik Gerdes <[email protected]>
@hegerdes
Copy link
Contributor Author

I gave it a try in #13190. Happy for feedback

hegerdes added a commit to hegerdes/hashicorp-packer that referenced this issue Oct 23, 2024
This adds support for additional http methods for the http datasource.
Fixes hashicorp#13169

Signed-off-by: Henrik Gerdes <[email protected]>
lbajolet-hashicorp pushed a commit that referenced this issue Oct 29, 2024
This adds support for additional http methods for the http datasource.
Fixes #13169

Signed-off-by: Henrik Gerdes <[email protected]>
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants