From e64b94ff6df0d6966bb9c0455155b4ef0d70bc67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Tue, 19 Aug 2025 17:48:38 +0200 Subject: [PATCH 1/2] chore: add support for testing generating documentation from terraform-plugin-docs --- .github/workflows/documentation.yml | 1 + internal/services/mongodb/instance.go | 26 ------------------- internal/services/rdb/read_replica.go | 36 --------------------------- internal/services/redis/cluster.go | 27 -------------------- 4 files changed, 1 insertion(+), 89 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 9153d6ce65..06fa841dca 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -65,3 +65,4 @@ jobs: go-version: ${{ env.GO_VERSION }} - uses: hashicorp/setup-terraform@v3 - run: go tool tfplugindocs validate + - run: go tool tfplugindocs generate diff --git a/internal/services/mongodb/instance.go b/internal/services/mongodb/instance.go index 3f287497e9..4187531ee9 100644 --- a/internal/services/mongodb/instance.go +++ b/internal/services/mongodb/instance.go @@ -179,32 +179,6 @@ func ResourceInstance() *schema.Resource { }, }, }, - "public_network": { - Type: schema.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - Description: "Public network specs details", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - Description: "ID of the public network", - }, - "port": { - Type: schema.TypeInt, - Computed: true, - Description: "TCP port of the endpoint", - }, - "dns_record": { - Type: schema.TypeString, - Computed: true, - Description: "The DNS record of your endpoint", - }, - }, - }, - }, "tags": { Type: schema.TypeList, Optional: true, diff --git a/internal/services/rdb/read_replica.go b/internal/services/rdb/read_replica.go index c9500cccb5..0dcb1c5d5c 100644 --- a/internal/services/rdb/read_replica.go +++ b/internal/services/rdb/read_replica.go @@ -50,42 +50,6 @@ func ResourceReadReplica() *schema.Resource { ForceNew: true, Description: "Defines whether to create the replica in the same availability zone as the main instance nodes or not.", }, - "direct_access": { - Type: schema.TypeList, - Optional: true, - Description: "Direct access endpoint, it gives you an IP and a port to access your read-replica", - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - // Endpoints common - "endpoint_id": { - Type: schema.TypeString, - Description: "UUID of the endpoint (UUID format).", - Computed: true, - }, - "ip": { - Type: schema.TypeString, - Description: "IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.", - Computed: true, - }, - "port": { - Type: schema.TypeInt, - Description: "TCP port of the endpoint.", - Computed: true, - }, - "name": { - Type: schema.TypeString, - Description: "Name of the endpoint.", - Computed: true, - }, - "hostname": { - Type: schema.TypeString, - Description: "Hostname of the endpoint. Only one of ip and hostname may be set.", - Computed: true, - }, - }, - }, - }, "private_network": { Type: schema.TypeList, Optional: true, diff --git a/internal/services/redis/cluster.go b/internal/services/redis/cluster.go index d578d9d12d..85d96ffd23 100644 --- a/internal/services/redis/cluster.go +++ b/internal/services/redis/cluster.go @@ -182,33 +182,6 @@ func ResourceCluster() *schema.Resource { }, }, // Computed - "public_network": { - Type: schema.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - Description: "Public network specs details", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, - "port": { - Type: schema.TypeInt, - Computed: true, - Description: "TCP port of the endpoint", - }, - "ips": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Computed: true, - }, - }, - }, - }, "private_ips": { Type: schema.TypeList, Computed: true, From f60f5ea15d9440edc5bb715af4c94dcf282e6894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Tue, 19 Aug 2025 18:09:55 +0200 Subject: [PATCH 2/2] fix uncorrect schemas --- internal/services/mongodb/instance.go | 29 +++++++++++++++++++ internal/services/rdb/read_replica.go | 41 +++++++++++++++++++++++++++ internal/services/redis/cluster.go | 30 ++++++++++++++++++++ 3 files changed, 100 insertions(+) diff --git a/internal/services/mongodb/instance.go b/internal/services/mongodb/instance.go index 4187531ee9..d8e805b415 100644 --- a/internal/services/mongodb/instance.go +++ b/internal/services/mongodb/instance.go @@ -179,6 +179,35 @@ func ResourceInstance() *schema.Resource { }, }, }, + "public_network": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Description: "Public network specs details", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "ID of the public network", + }, + "port": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "TCP port of the endpoint", + }, + "dns_record": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The DNS record of your endpoint", + }, + }, + }, + }, "tags": { Type: schema.TypeList, Optional: true, diff --git a/internal/services/rdb/read_replica.go b/internal/services/rdb/read_replica.go index 0dcb1c5d5c..e20f4f3708 100644 --- a/internal/services/rdb/read_replica.go +++ b/internal/services/rdb/read_replica.go @@ -50,6 +50,47 @@ func ResourceReadReplica() *schema.Resource { ForceNew: true, Description: "Defines whether to create the replica in the same availability zone as the main instance nodes or not.", }, + "direct_access": { + Type: schema.TypeList, + Optional: true, + Description: "Direct access endpoint, it gives you an IP and a port to access your read-replica", + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + // Endpoints common + "endpoint_id": { + Type: schema.TypeString, + Description: "UUID of the endpoint (UUID format).", + Optional: true, + Computed: true, + }, + "ip": { + Type: schema.TypeString, + Description: "IPv4 address of the endpoint (IP address). Only one of ip and hostname may be set.", + Optional: true, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Description: "TCP port of the endpoint.", + Optional: true, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Description: "Name of the endpoint.", + Optional: true, + Computed: true, + }, + "hostname": { + Type: schema.TypeString, + Description: "Hostname of the endpoint. Only one of ip and hostname may be set.", + Optional: true, + Computed: true, + }, + }, + }, + }, "private_network": { Type: schema.TypeList, Optional: true, diff --git a/internal/services/redis/cluster.go b/internal/services/redis/cluster.go index 85d96ffd23..46d499fe91 100644 --- a/internal/services/redis/cluster.go +++ b/internal/services/redis/cluster.go @@ -182,6 +182,36 @@ func ResourceCluster() *schema.Resource { }, }, // Computed + "public_network": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Description: "Public network specs details", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "port": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "TCP port of the endpoint", + }, + "ips": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Computed: true, + }, + }, + }, + }, "private_ips": { Type: schema.TypeList, Computed: true,