Skip to content

Commit ae86a90

Browse files
committed
working
notes in readme all tests passing, working on a local server with real examples docs lint fixes add comment on folder deletion recursion notes on reviewing better handling for config variables as secret update docs lint lint add resources resource docs fix test lint lint lint docs update wip on resource configs Bump golang.org/x/crypto from 0.23.0 to 0.35.0 (#53) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.23.0 to 0.35.0. - [Commits](golang/crypto@v0.23.0...v0.35.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-version: 0.35.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> [feat][gov] Update repo to reflect v.2.9.0 of the API (#52) * update repo to reflect v.2.9.0 of the api * fixes to cursor slop * notes in readme * all tests passing, working on a local server with real examples * docs * lint fixes * add comment on folder deletion recursion * notes on reviewing * better handling for config variables as secret * update docs * lint * lint [feat][gov] Add ability to manage resources (#55) * update repo to reflect v.2.9.0 of the api * fixes to cursor slop * notes in readme * all tests passing, working on a local server with real examples * docs * lint fixes * add comment on folder deletion recursion * notes on reviewing * better handling for config variables as secret * update docs * lint * lint * add resources resource * docs * fix test * lint * lint * lint * docs update * more accurate docs probable fixes more linting
1 parent b1c436e commit ae86a90

File tree

120 files changed

+5864
-1357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+5864
-1357
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,13 @@ New version should show up on Terraform Repository in 10-15 minutes.
6666
# Update Retool CLI
6767
Retool CLI has a `terraform` command that generates Terraform configuration from existing Retool org: https://github.com/tryretool/retool-cli/blob/master/src/commands/terraform.ts.
6868
If you added a new resource or updated an existing one, you should update Retool CLI as well, so that your changes are reflected in auto-generated configuration.
69+
70+
# Reviewing
71+
72+
Reviewing PRs to this repo can be a challenge, particularly when they impact the OpenAPI generated code for the SDK.
73+
74+
As a general rule, code within `internal/provider/sdk` will be generated, and can largely be ignored during reviews.
75+
76+
Code _outside_ of this should be given close attention. `internal/provider` code is what drives the terraform behavior, and should be reviewed for correctness and backward compatibility. Tests should accompany new features, and reviewers should make a habit of checking out PR branches and running them against realisitic example retool deployments.
77+
78+
Updates should always include documentation updates for new/changed behaviors.

docs/data-sources/folders.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ output "all_folders" {
3030

3131
Read-Only:
3232

33-
- `folder_type` (String) The type of the folder: (app|file|resource|workflow).
33+
- `folder_type` (String) The type of the folder: (app|file|resource|workflow|agent).
3434
- `id` (String) The id of the folder.
3535
- `is_system_folder` (Boolean) Whether the folder is a system folder.
3636
- `legacy_id` (String) The legacy id of the folder.

docs/data-sources/groups.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ output "all_groups" {
3030

3131
Read-Only:
3232

33+
- `account_details_access` (Boolean) Whether the group has access to account details.
3334
- `audit_log_access` (Boolean) Whether the group has audit log access.
3435
- `created_at` (String) The date the group was created.
3536
- `id` (String) The id of the group.
3637
- `landing_page_app_id` (String) The id of the landing page app for the group.
3738
- `legacy_id` (String) The legacy id of the group.
3839
- `members` (Attributes List) The members of the group. (see [below for nested schema](#nestedatt--groups--members))
3940
- `name` (String) The name of the group.
41+
- `theme_access` (Boolean) Whether the group has access to edit themes.
4042
- `universal_app_access` (String) The universal app access level of the group.
4143
- `universal_query_library_access` (String) The universal query library access level of the group.
4244
- `universal_resource_access` (String) The universal resource access level of the group.

docs/resources/configuration_variable.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,46 @@ Manages a Retool configuration variable. Configuration variables are used to sto
1212

1313
```terraform
1414
resource "retool_configuration_variable" "test_config_var" {
15-
name = "Test Space"
16-
value = [
15+
name = "Test Config Var"
16+
values = [
1717
{
18-
environment_id = "production"
18+
environment_id = "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d" # prod
1919
value = "value1"
2020
},
2121
{
22-
environment_id = "staging"
22+
environment_id = "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e" # staging
2323
value = "value2"
2424
}
2525
]
2626
}
2727
28-
resource "retool_configuration_variable" "test_config_var_with_descritpion" {
29-
name = "Test Space with creation options"
28+
resource "retool_configuration_variable" "test_config_var_with_description" {
29+
name = "Test Config Var with description"
3030
description = "This is a test configuration variable with a description"
31-
value = [
31+
values = [
3232
{
33-
environment_id = "production"
33+
environment_id = "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d" # prod
3434
value = "value1"
3535
},
3636
{
37-
environment_id = "staging"
37+
environment_id = "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e" # staging
3838
value = "value2"
3939
}
4040
]
4141
}
4242
4343
resource "retool_configuration_variable" "test_config_var_as_secret" {
44-
name = "Test Space with creation options"
45-
description = "This is a test configuration variable with a description"
44+
name = "Test Secret Config Var"
45+
description = "This is a secret configuration variable"
4646
secret = true
47-
value = [
47+
values = [
4848
{
49-
environment_id = "production"
50-
value = "value1"
49+
environment_id = "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d" # prod
50+
value = "secret_value1"
5151
},
5252
{
53-
environment_id = "staging"
54-
value = "value2"
53+
environment_id = "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e" # staging
54+
value = "secret_value2"
5555
}
5656
]
5757
}
@@ -68,18 +68,18 @@ resource "retool_configuration_variable" "test_config_var_as_secret" {
6868
### Optional
6969

7070
- `description` (String) A brief description of the configuration variable's purpose.
71+
- `secret` (Boolean) Whether the configuration variable is a secret. Secrets are encrypted and not exposed in the Retool UI.
7172

7273
### Read-Only
7374

7475
- `id` (String) The unique identifier for the configuration variable.
75-
- `secret` (Boolean) Whether the configuration variable is a secret. Secrets are encrypted and not exposed in the Retool UI. Secert is currently not supported as the values are encrypted and cannot be retrieved via the API.
7676

7777
<a id="nestedatt--values"></a>
7878
### Nested Schema for `values`
7979

8080
Required:
8181

8282
- `environment_id` (String) The ID of the environment this value is associated with.
83-
- `value` (String) The value of the configuration variable for the specified environment.
83+
- `value` (String, Sensitive) The value of the configuration variable for the specified environment.
8484

8585

docs/resources/folder.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,24 @@ resource "retool_folder" "resource_example" {
2626
name = "Terraform Example Folder"
2727
folder_type = "resource"
2828
}
29+
30+
resource "retool_folder" "workflow_example" {
31+
name = "Terraform Workflow Folder"
32+
folder_type = "workflow"
33+
}
34+
35+
resource "retool_folder" "agent_example" {
36+
name = "Terraform Agent Folder"
37+
folder_type = "agent"
38+
}
2939
```
3040

3141
<!-- schema generated by tfplugindocs -->
3242
## Schema
3343

3444
### Required
3545

36-
- `folder_type` (String) The type of the folder: (app|resource|workflow).
46+
- `folder_type` (String) The type of the folder: (app|resource|workflow|agent).
3747
- `name` (String) The name of the folder.
3848

3949
### Optional

docs/resources/group.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ resource "retool_group" "example" {
2222
audit_log_access = true
2323
unpublished_release_access = false
2424
usage_analytics_access = true
25+
theme_access = false
2526
account_details_access = true
2627
landing_page_app_id = "c37676ba-116f-11ea-b17d-d7734e1526f2"
2728
}
@@ -39,6 +40,7 @@ resource "retool_group" "example" {
3940
- `account_details_access` (Boolean) Whether the group has access to account details.
4041
- `audit_log_access` (Boolean) Whether the group has access to the audit log.
4142
- `landing_page_app_id` (String) The app ID of the landing page.
43+
- `theme_access` (Boolean) Whether the group has access to edit themes.
4244
- `universal_app_access` (String) The universal app access level for the group. This denotes the access level that this group has for all apps. Accepted values: none|use|edit|own
4345
- `universal_query_library_access` (String) Level of access that the group has to the Query Library. Accepted values: none|use|edit
4446
- `universal_resource_access` (String) The universal resource access level for the group. This denotes the access level that this group has for all resources. Accepted values: none|use|edit|own

docs/resources/resource.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
page_title: "Resource: retool_resource"
3+
description: |-
4+
A Retool resource represents a connection to an external service such as a database, API, or other data source.
5+
Important Note: Due to API security design, the options field (which contains connection credentials and configuration) is write-only and cannot be read back after creation. This means:
6+
Changes to options will not be detected by Terraform after the resource is createdThe options value will not be stored in Terraform state after initial creationTo update resource options, you must use the Retool UI or recreate the resource
7+
---
8+
9+
# Resource: retool_resource
10+
11+
A Retool resource represents a connection to an external service such as a database, API, or other data source.
12+
13+
**Important Note:** Due to API security design, the options field (which contains connection credentials and configuration) is write-only and cannot be read back after creation. This means:
14+
- Changes to options will not be detected by Terraform after the resource is created
15+
- The options value will not be stored in Terraform state after initial creation
16+
- To update resource options, you must use the Retool UI or recreate the resource
17+
18+
## Example Usage
19+
20+
```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+
35+
resource "retool_resource" "api" {
36+
display_name = "My REST API"
37+
type = "restapi"
38+
39+
options = jsonencode({
40+
base_url = "https://api.example.com"
41+
authentication_options = {
42+
authentication_type = "basic"
43+
basic_username = "admin"
44+
basic_password = "password"
45+
}
46+
})
47+
48+
lifecycle {
49+
# Ignore changes to options since they can't be read back from the API
50+
ignore_changes = [options]
51+
}
52+
}
53+
54+
resource "retool_resource" "database" {
55+
display_name = "Production Database"
56+
type = "postgresql"
57+
58+
options = jsonencode({
59+
host = "db.example.com"
60+
port = 5432
61+
database_name = "myapp"
62+
database_username = var.db_username
63+
database_password = var.db_password
64+
ssl_settings = {
65+
ssl_enabled = true
66+
}
67+
})
68+
69+
lifecycle {
70+
ignore_changes = [options]
71+
}
72+
}
73+
```
74+
75+
<!-- schema generated by tfplugindocs -->
76+
## Schema
77+
78+
### Required
79+
80+
- `display_name` (String) The display name of the resource.
81+
- `options` (String, Sensitive) JSON string containing the resource configuration options. The structure varies by resource type. This field is write-only and cannot be read back after creation.
82+
- `type` (String) The type of resource (e.g., 'restapi', 'postgresql', 'mysql', 'snowflake'). Cannot be changed after creation.
83+
84+
### Read-Only
85+
86+
- `created_at` (String) The timestamp when the resource was created.
87+
- `id` (String) The UUID of the resource.
88+
- `protected` (Boolean) Whether the resource is protected in source control.
89+
- `updated_at` (String) The timestamp when the resource was last updated.
90+
91+
## Import
92+
93+
Import is supported using the following syntax:
94+
95+
```shell
96+
#!/bin/bash
97+
# Import a Retool resource using its UUID
98+
# Note: The options field will not be imported and must be set in your configuration
99+
terraform import retool_resource.example "resource_uuid_here"
100+
```
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
page_title: "retool_resource_configuration Resource - terraform-provider-retool"
3+
subcategory: ""
4+
description: |-
5+
Manages a resource configuration in Retool.
6+
---
7+
8+
# retool_resource_configuration (Resource)
9+
10+
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).
11+
12+
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.
13+
14+
## Example Usage
15+
16+
```terraform
17+
# First, create a resource
18+
resource "retool_resource" "postgres" {
19+
display_name = "PostgreSQL Database"
20+
type = "postgresql"
21+
options = jsonencode({
22+
host = "localhost"
23+
port = 5432
24+
database = "mydb"
25+
user = "default_user"
26+
})
27+
}
28+
29+
# Get environments
30+
data "retool_environments" "all" {}
31+
32+
# Create a production-specific configuration
33+
resource "retool_resource_configuration" "postgres_production" {
34+
resource_id = retool_resource.postgres.id
35+
environment_id = [for env in data.retool_environments.all.environments : env.id if env.name == "production"][0]
36+
37+
options = jsonencode({
38+
host = "prod-db.example.com"
39+
port = 5432
40+
database = "production_db"
41+
user = "prod_user"
42+
password = "prod_password"
43+
ssl = true
44+
})
45+
}
46+
47+
# Create a staging-specific configuration
48+
resource "retool_resource_configuration" "postgres_staging" {
49+
resource_id = retool_resource.postgres.id
50+
environment_id = [for env in data.retool_environments.all.environments : env.id if env.name == "staging"][0]
51+
52+
options = jsonencode({
53+
host = "staging-db.example.com"
54+
port = 5432
55+
database = "staging_db"
56+
user = "staging_user"
57+
password = "staging_password"
58+
ssl = true
59+
})
60+
}
61+
```
62+
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+
90+
## Schema
91+
92+
### Required
93+
94+
- `resource_id` (String) The UUID or name of the resource to configure. Cannot be changed after creation.
95+
- `environment_id` (String) The UUID of the environment for this configuration. Cannot be changed after creation.
96+
- `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.
97+
98+
### Read-Only
99+
100+
- `id` (String) The UUID of the resource configuration.
101+
- `created_at` (String) The timestamp when the resource configuration was created.
102+
- `updated_at` (String) The timestamp when the resource configuration was last updated.
103+
104+
## Import
105+
106+
Resource configurations can be imported using their ID:
107+
108+
```shell
109+
terraform import retool_resource_configuration.example 01234567-89ab-cdef-0123-456789abcdef
110+
```
111+
112+
**Note:** After importing, you will need to manually set the `options` field in your Terraform configuration to match the current configuration.
113+

docs/resources/source_control_settings.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ resource "retool_source_control_settings" "scm_settings" {
1616
custom_pull_request_template_enabled = true
1717
custom_pull_request_template = "custom-pull-request-template"
1818
version_control_locked = true
19+
auto_cleanup_branches_enabled = false
1920
force_uuid_mapping = false
2021
}
2122
```
@@ -26,6 +27,7 @@ resource "retool_source_control_settings" "scm_settings" {
2627
### Optional
2728

2829
- `auto_branch_naming_enabled` (Boolean) When enabled, Retool automatically suggests a branch name on branch creation. Defaults to true.
30+
- `auto_cleanup_branches_enabled` (Boolean) When enabled, Retool automatically cleans up branches after they are merged. Defaults to false.
2931
- `custom_pull_request_template` (String) Pull requests created from Retool will use the template specified.
3032
- `custom_pull_request_template_enabled` (Boolean) When enabled, Retool will use the template specified to create pull requests. Defaults to false.
3133
- `force_uuid_mapping` (Boolean) When set to true, creates a uuid mapping for protected elements to be used in the source control repo. Defaults to false.

0 commit comments

Comments
 (0)