File tree Expand file tree Collapse file tree 4 files changed +96
-6
lines changed Expand file tree Collapse file tree 4 files changed +96
-6
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,48 @@ description: |-
10
10
11
11
Fetches the response for the api
12
12
13
-
13
+ ## Example Usage
14
+
15
+ ``` terraform
16
+ terraform {
17
+ required_providers {
18
+ curl2 = {
19
+ source = "mehulgohil/curl2"
20
+ version = "1.0.0"
21
+ }
22
+ }
23
+ }
24
+
25
+ provider "curl2" {}
26
+
27
+ data "curl2" "getPosts" {
28
+ http_method = "GET"
29
+ uri = "https://jsonplaceholder.typicode.com/posts"
30
+ # auth_type = "Basic"
31
+ # basic_auth_username = "<UserName>"
32
+ # basic_auth_password = "<Password>"
33
+ }
34
+
35
+ output "all_posts_response" {
36
+ value = jsondecode(data.curl2.getPosts.response.body)
37
+ }
38
+
39
+ output "all_posts_status" {
40
+ value = data.curl2.getPosts.response.status_code
41
+ }
42
+
43
+ data "curl2" "postPosts" {
44
+ http_method = "POST"
45
+ uri = "https://jsonplaceholder.typicode.com/posts"
46
+ json = "{\"title\":\"foo\",\"body\":\"bar\",\"userId\":\"1\"}" //need the json in string format
47
+ # auth_type = "Bearer"
48
+ # bearer_token = "<Any Bearer Token>"
49
+ }
50
+
51
+ output "post_posts_output" {
52
+ value = data.curl2.postPosts.response
53
+ }
54
+ ```
14
55
15
56
<!-- schema generated by tfplugindocs -->
16
57
## Schema
Original file line number Diff line number Diff line change @@ -10,7 +10,33 @@ description: |-
10
10
11
11
Triggers HTTP(s) requests along with JSON body and authentication
12
12
13
+ ## Example Usage
13
14
15
+ ``` terraform
16
+ terraform {
17
+ required_providers {
18
+ curl2 = {
19
+ source = "mehulgohil/curl2"
20
+ version = "1.0.0"
21
+ }
22
+ }
23
+ }
24
+
25
+ provider "curl2" {}
26
+
27
+ data "curl2" "getPosts" {
28
+ http_method = "GET"
29
+ uri = "https://jsonplaceholder.typicode.com/posts"
30
+ }
31
+
32
+ output "all_posts_response" {
33
+ value = jsondecode(data.curl2.getPosts.response.body)
34
+ }
35
+
36
+ output "all_posts_status" {
37
+ value = data.curl2.getPosts.response.status_code
38
+ }
39
+ ```
14
40
15
41
<!-- schema generated by tfplugindocs -->
16
42
## Schema
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ provider "curl2" {}
12
12
data "curl2" "getPosts" {
13
13
http_method = " GET"
14
14
uri = " https://jsonplaceholder.typicode.com/posts"
15
- # auth_type = "Basic"
16
- # basic_auth_username = "<UserName>"
17
- # basic_auth_password = "<Password>"
15
+ # auth_type = "Basic"
16
+ # basic_auth_username = "<UserName>"
17
+ # basic_auth_password = "<Password>"
18
18
}
19
19
20
20
output "all_posts_response" {
@@ -29,8 +29,8 @@ data "curl2" "postPosts" {
29
29
http_method = " POST"
30
30
uri = " https://jsonplaceholder.typicode.com/posts"
31
31
json = " {\" title\" :\" foo\" ,\" body\" :\" bar\" ,\" userId\" :\" 1\" }" // need the json in string format
32
- # auth_type = "Bearer"
33
- # bearer_token = "<Any Bearer Token>"
32
+ # auth_type = "Bearer"
33
+ # bearer_token = "<Any Bearer Token>"
34
34
}
35
35
36
36
output "post_posts_output" {
Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_providers {
3
+ curl2 = {
4
+ source = " mehulgohil/curl2"
5
+ version = " 1.0.0"
6
+ }
7
+ }
8
+ }
9
+
10
+ provider "curl2" {}
11
+
12
+ data "curl2" "getPosts" {
13
+ http_method = " GET"
14
+ uri = " https://jsonplaceholder.typicode.com/posts"
15
+ }
16
+
17
+ output "all_posts_response" {
18
+ value = jsondecode (data. curl2 . getPosts . response . body )
19
+ }
20
+
21
+ output "all_posts_status" {
22
+ value = data. curl2 . getPosts . response . status_code
23
+ }
You can’t perform that action at this time.
0 commit comments