Feature/issue 300 - Http Resource#558
Open
Prajwal-Shah wants to merge 5 commits intohashicorp:mainfrom
Open
Conversation
1 task
6e67188 to
b5988cd
Compare
- Introduce optional when attribute for http resource: apply (default) or destroy - Execute HTTP request on Create/Update when when = "apply" - Execute HTTP request only on Delete when when = "destroy" - Do not send HTTP requests on Read; preserve state on Update when when = "destroy" - Ensure all computed fields are set to known values when skipping requests (id, headers, body, body_base64, status_code) - Add tests for apply, destroy, and default behaviors - Update docs and examples to cover when semantics
Earlier it was using modelV1 which also changed docs for data-source Introduced new modelV1 with when attribute for resource http
b5988cd to
d45cea0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Fixes #300
Description
This pull request introduces a new
httpresource to the provider. Thehttpresource allows users to perform HTTP requests as part of their Terraform apply or destroy operations, capturing response data such as headers, body, and status code in the Terraform state.Key design decisions and features:
GET,HEAD, andPOSTmethods, with optional request headers and body.whenargument that allows users to control whether the request is sent during apply (create/update) or destroy.whenattribute without affecting the existing data-source module.whenare "apply" and "destroy"when = "apply"(default):The provider sends the request during create and update operations. Computed response values are saved to the state file.
when = "destroy":The provider sends the request only during resource deletion. During
terraform apply, computed response attributes will be empty or zero, while input attributes are stored as provided.go-retryablehttp.docs/andexamples/directories.internal/provider/resource_http_test.go.This design provides flexibility for users needing to trigger HTTP endpoints as part of their infrastructure workflows, while maintaining a clear separation from the existing data source.
Files added/modified (main...feature/issue-300)
Rollback Plan
Changes to Security Controls
Changes to Security Controls
resource/httpimplementation reuses the request-handling logic fromdata-source/http, ensuring consistency in behavior.data-source/http.Sample Plan