Skip to content

Commit 3163216

Browse files
committed
review changes 5 (improve example)
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
1 parent aebda00 commit 3163216

File tree

2 files changed

+48
-48
lines changed

2 files changed

+48
-48
lines changed

docs/ephemeral-resources/access_token.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,30 @@ locals {
3535
}
3636
}
3737
38+
# Docs: https://registry.terraform.io/providers/magodo/restful/latest
39+
provider "restful" {
40+
base_url = local.stackit_api_base_url
41+
42+
security = {
43+
http = {
44+
token = {
45+
token = ephemeral.stackit_access_token.example.access_token
46+
}
47+
}
48+
}
49+
}
50+
51+
resource "restful_resource" "public_ip_restful" {
52+
path = local.public_ip_path
53+
body = local.public_ip_payload
54+
55+
read_path = "$(path)/$(body.id)"
56+
update_path = "$(path)/$(body.id)"
57+
update_method = "PATCH"
58+
delete_path = "$(path)/$(body.id)"
59+
delete_method = "DELETE"
60+
}
61+
3862
# Docs: https://registry.terraform.io/providers/Mastercard/restapi/latest
3963
provider "restapi" {
4064
uri = local.stackit_api_base_url
@@ -60,30 +84,6 @@ resource "restapi_object" "public_ip_restapi" {
6084
update_method = "PATCH"
6185
destroy_method = "DELETE"
6286
}
63-
64-
# Docs: https://registry.terraform.io/providers/magodo/restful/latest
65-
provider "restful" {
66-
base_url = local.stackit_api_base_url
67-
68-
security = {
69-
http = {
70-
token = {
71-
token = ephemeral.stackit_access_token.example.access_token
72-
}
73-
}
74-
}
75-
}
76-
77-
resource "restful_resource" "public_ip_restful" {
78-
path = local.public_ip_path
79-
data = jsonencode(local.public_ip_payload)
80-
81-
read_path = "$(path)/$(body.id)"
82-
update_path = "$(path)/$(body.id)"
83-
update_method = "PATCH"
84-
delete_path = "$(path)/$(body.id)"
85-
delete_method = "DELETE"
86-
}
8787
```
8888

8989
<!-- schema generated by tfplugindocs -->

examples/ephemeral-resources/stackit_access_token/ephemeral-resource.tf

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,30 @@ locals {
1717
}
1818
}
1919

20+
# Docs: https://registry.terraform.io/providers/magodo/restful/latest
21+
provider "restful" {
22+
base_url = local.stackit_api_base_url
23+
24+
security = {
25+
http = {
26+
token = {
27+
token = ephemeral.stackit_access_token.example.access_token
28+
}
29+
}
30+
}
31+
}
32+
33+
resource "restful_resource" "public_ip_restful" {
34+
path = local.public_ip_path
35+
body = local.public_ip_payload
36+
37+
read_path = "$(path)/$(body.id)"
38+
update_path = "$(path)/$(body.id)"
39+
update_method = "PATCH"
40+
delete_path = "$(path)/$(body.id)"
41+
delete_method = "DELETE"
42+
}
43+
2044
# Docs: https://registry.terraform.io/providers/Mastercard/restapi/latest
2145
provider "restapi" {
2246
uri = local.stackit_api_base_url
@@ -42,27 +66,3 @@ resource "restapi_object" "public_ip_restapi" {
4266
update_method = "PATCH"
4367
destroy_method = "DELETE"
4468
}
45-
46-
# Docs: https://registry.terraform.io/providers/magodo/restful/latest
47-
provider "restful" {
48-
base_url = local.stackit_api_base_url
49-
50-
security = {
51-
http = {
52-
token = {
53-
token = ephemeral.stackit_access_token.example.access_token
54-
}
55-
}
56-
}
57-
}
58-
59-
resource "restful_resource" "public_ip_restful" {
60-
path = local.public_ip_path
61-
data = jsonencode(local.public_ip_payload)
62-
63-
read_path = "$(path)/$(body.id)"
64-
update_path = "$(path)/$(body.id)"
65-
update_method = "PATCH"
66-
delete_path = "$(path)/$(body.id)"
67-
delete_method = "DELETE"
68-
}

0 commit comments

Comments
 (0)