Skip to content

Commit d514fbe

Browse files
committed
merge main
2 parents 23bd1cb + 3e517a6 commit d514fbe

File tree

5 files changed

+64
-57
lines changed

5 files changed

+64
-57
lines changed

docs/resources/resource.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,30 @@ A Retool resource represents a connection to an external service such as a datab
1818
## Example Usage
1919

2020
```terraform
21+
resource "retool_resource" "api" {
22+
display_name = "My REST API"
23+
type = "restapi"
24+
25+
options = jsonencode({
26+
base_url = "https://api.example.com"
27+
})
28+
29+
lifecycle {
30+
# Ignore changes to options since they can't be read back from the API
31+
ignore_changes = [options]
32+
}
33+
}
34+
2135
resource "retool_resource" "api" {
2236
display_name = "My REST API"
2337
type = "restapi"
2438
2539
options = jsonencode({
2640
base_url = "https://api.example.com"
2741
authentication_options = {
28-
authentication_type = "None"
42+
authentication_type = "basic"
43+
basic_username = "admin"
44+
basic_password = "password"
2945
}
3046
})
3147

docs/resources/resource_configuration.md

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
page_title: "retool_resource_configuration Resource - terraform-provider-retool"
3-
subcategory: ""
2+
page_title: "Resource: retool_resource_configuration"
43
description: |-
5-
Manages a resource configuration in Retool.
4+
A resource configuration defines environment-specific configuration for a Retool resource. This allows you to configure different connection settings, credentials, and options for a resource across different environments (e.g., production, staging, development).
5+
For example, you might have a PostgreSQL resource that connects to different database instances in production vs. staging environments, each with different credentials and connection strings.
66
---
77

8-
# retool_resource_configuration (Resource)
8+
# Resource: retool_resource_configuration
99

1010
A resource configuration defines environment-specific configuration for a Retool resource. This allows you to configure different connection settings, credentials, and options for a resource across different environments (e.g., production, staging, development).
1111

@@ -60,54 +60,28 @@ resource "retool_resource_configuration" "postgres_staging" {
6060
}
6161
```
6262

63-
### REST API Example
64-
65-
```terraform
66-
# Create a REST API resource
67-
resource "retool_resource" "api" {
68-
display_name = "External API"
69-
type = "restapi"
70-
options = jsonencode({
71-
base_url = "https://api.example.com"
72-
})
73-
}
74-
75-
# Production configuration with different base URL and authentication
76-
resource "retool_resource_configuration" "api_production" {
77-
resource_id = retool_resource.api.id
78-
environment_id = data.retool_environments.all.environments[0].id
79-
80-
options = jsonencode({
81-
base_url = "https://api.production.example.com"
82-
headers = {
83-
"Authorization" = "Bearer ${var.prod_api_token}"
84-
"X-Environment" = "production"
85-
}
86-
})
87-
}
88-
```
89-
63+
<!-- schema generated by tfplugindocs -->
9064
## Schema
9165

9266
### Required
9367

94-
- `resource_id` (String) The UUID or name of the resource to configure. Cannot be changed after creation.
9568
- `environment_id` (String) The UUID of the environment for this configuration. Cannot be changed after creation.
9669
- `options` (String, Sensitive) JSON string containing the environment-specific resource configuration options. The structure varies by resource type and mirrors the options structure used when creating a resource.
70+
- `resource_id` (String) The UUID or name of the resource to configure. Cannot be changed after creation.
9771

9872
### Read-Only
9973

100-
- `id` (String) The UUID of the resource configuration.
10174
- `created_at` (String) The timestamp when the resource configuration was created.
75+
- `id` (String) The UUID of the resource configuration.
10276
- `updated_at` (String) The timestamp when the resource configuration was last updated.
10377

10478
## Import
10579

106-
Resource configurations can be imported using their ID:
80+
Import is supported using the following syntax:
10781

10882
```shell
83+
#!/bin/bash
84+
85+
# Import a resource configuration using its ID
10986
terraform import retool_resource_configuration.example 01234567-89ab-cdef-0123-456789abcdef
11087
```
111-
112-
**Note:** After importing, you will need to manually set the `options` field in your Terraform configuration to match the current configuration.
113-

examples/resources/retool_resource/resource.tf

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
resource "retool_resource" "api" {
2+
display_name = "My REST API"
3+
type = "restapi"
4+
5+
options = jsonencode({
6+
base_url = "https://api.example.com"
7+
})
8+
9+
lifecycle {
10+
# Ignore changes to options since they can't be read back from the API
11+
ignore_changes = [options]
12+
}
13+
}
14+
115
resource "retool_resource" "api" {
216
display_name = "My REST API"
317
type = "restapi"
418

519
options = jsonencode({
620
base_url = "https://api.example.com"
721
authentication_options = {
8-
authentication_type = "None"
22+
authentication_type = "basic"
23+
basic_username = "admin"
24+
basic_password = "password"
925
}
1026
})
1127

go.mod

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/tryretool/terraform-provider-retool
22

3-
go 1.22.3
3+
go 1.23.0
44

55
require (
66
github.com/hashicorp/terraform-plugin-docs v0.19.4
@@ -74,12 +74,13 @@ require (
7474
github.com/yuin/goldmark-meta v1.1.0 // indirect
7575
github.com/zclconf/go-cty v1.14.4 // indirect
7676
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
77-
golang.org/x/crypto v0.23.0 // indirect
77+
golang.org/x/crypto v0.35.0 // indirect
7878
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
79-
golang.org/x/net v0.23.0 // indirect
80-
golang.org/x/sys v0.20.0 // indirect
81-
golang.org/x/text v0.15.0 // indirect
82-
golang.org/x/tools v0.13.0 // indirect
79+
golang.org/x/net v0.25.0 // indirect
80+
golang.org/x/sync v0.11.0 // indirect
81+
golang.org/x/sys v0.30.0 // indirect
82+
golang.org/x/text v0.22.0 // indirect
83+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
8384
google.golang.org/appengine v1.6.8 // indirect
8485
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
8586
google.golang.org/grpc v1.63.2 // indirect

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px
212212
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
213213
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
214214
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
215-
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
216-
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
215+
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
216+
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
217217
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
218218
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
219219
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@@ -224,13 +224,13 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
224224
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
225225
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
226226
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
227-
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
228-
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
227+
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
228+
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
229229
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
230230
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
231231
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
232-
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
233-
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
232+
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
233+
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
234234
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
235235
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
236236
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -244,8 +244,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
244244
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
245245
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
246246
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
247-
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
248-
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
247+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
248+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
249249
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
250250
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
251251
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
@@ -255,15 +255,15 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
255255
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
256256
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
257257
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
258-
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
259-
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
258+
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
259+
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
260260
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
261261
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
262262
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
263263
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
264264
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
265-
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
266-
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
265+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
266+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
267267
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
268268
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
269269
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=

0 commit comments

Comments
 (0)