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

HTTP resource #255

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

HTTP resource #255

wants to merge 9 commits into from

Conversation

eveld
Copy link
Contributor

@eveld eveld commented Nov 14, 2023

The HTTP resource allows you to execute HTTP requests and use the response in other resources.

resource "http" "get" {
  method = "GET"

  url = "https://httpbin.org/get"

  headers = {
    Accept = "application/json"
  }
}

resource "http" "post" {
  method = "POST"

  url = "https://httpbin.org/post"

  payload = jsonencode({
    foo = "bar"
  })

  headers = {
    Accept = "application/json"
  }
}

output "get_body" {
  value = resource.http.get.status == 200 ? resource.http.get.body : "error"
}

output "post_body" {
  value = resource.http.post.status == 200 ? resource.http.post.body : "error"
}

@eveld eveld marked this pull request as draft November 14, 2023 18:13
@nicholasjackson nicholasjackson self-requested a review April 16, 2024 09:32
@nicholasjackson nicholasjackson marked this pull request as ready for review April 16, 2024 09:32
@eveld eveld added enhancement New feature or request minor and removed patch labels Apr 17, 2024
@eveld eveld added the provider label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants