From b346a64f499be44e8787ce78e11e89b6db3dad7d Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Tue, 25 Jun 2024 10:44:33 +0200 Subject: [PATCH 01/21] Add private link support --- CHANGELOG.md | 29 +- docs/data-sources/connector.md | 3 +- docs/data-sources/destination.md | 3 +- docs/data-sources/hybrid_deployment_agent.md | 29 ++ docs/data-sources/hybrid_deployment_agents.md | 35 ++ docs/data-sources/local_processing_agent.md | 38 -- docs/data-sources/local_processing_agents.md | 44 -- docs/data-sources/private_link.md | 54 ++ docs/data-sources/private_links.md | 35 ++ docs/data-sources/private_links.md.tmpl | 16 + docs/guides/version_1.4.0_update_guides.md | 64 +++ docs/resources/connector.md | 3 +- docs/resources/connector_schema_config.md | 1 + docs/resources/destination.md | 3 +- docs/resources/hybrid_deployment_agent.md | 41 ++ docs/resources/local_processing_agent.md | 51 -- docs/resources/private_link.md | 62 +++ fivetran/framework/core/core.go | 2 +- fivetran/framework/core/model/connector.go | 474 +++++++++--------- fivetran/framework/core/model/destination.go | 6 +- .../model/destination_datasource_model.go | 72 +-- .../core/model/destination_resource_model.go | 17 +- ...ng_agent.go => hybrid_deployment_agent.go} | 11 +- ...ybrid_deployment_agent_datasource_model.go | 36 ++ .../hybrid_deployment_agent_resource_model.go | 51 ++ .../core/model/hybrid_deployment_agents.go | 41 ++ ...local_processing_agent_datasource_model.go | 65 --- .../local_processing_agent_resource_model.go | 71 --- .../core/model/local_processing_agents.go | 65 --- fivetran/framework/core/model/private_link.go | 226 +++++++++ .../framework/core/model/private_links.go | 51 ++ fivetran/framework/core/schema/connector.go | 9 +- fivetran/framework/core/schema/destination.go | 12 +- ...ng_agent.go => hybrid_deployment_agent.go} | 78 +-- .../framework/core/schema/private_link.go | 246 +++++++++ ...ng_agent.go => hybrid_deployment_agent.go} | 22 +- .../hybrid_deployment_agent_test.go | 87 ++++ .../datasources/hybrid_deployment_agents.go | 84 ++++ .../hybrid_deployment_agents_test.go | 111 ++++ .../local_processing_agent_test.go | 93 ---- .../local_processing_agents_test.go | 124 ----- .../framework/datasources/private_link.go | 60 +++ .../datasources/private_link_test.go | 92 ++++ ..._processing_agents.go => private_links.go} | 32 +- .../datasources/private_links_test.go | 111 ++++ fivetran/framework/provider.go | 11 +- fivetran/framework/resources/connector.go | 23 +- .../resources/connector_migrations.go | 11 +- fivetran/framework/resources/destination.go | 21 +- .../resources/destination_migrations.go | 9 +- ...ng_agent.go => hybrid_deployment_agent.go} | 52 +- .../resources/hybrid_deployment_agent_test.go | 95 ++++ .../resources/local_processing_agent_test.go | 95 ---- fivetran/framework/resources/private_link.go | 167 ++++++ .../framework/resources/private_link_test.go | 104 ++++ fivetran/tests/e2e/fivetran_test.go | 28 +- ...source_hybrid_deployment_agent_e2e_test.go | 73 +++ ...esource_local_processing_agent_e2e_test.go | 73 --- .../e2e/resource_private_link_e2e_test.go | 70 +++ ...e_connector_dynamic_fields_mapping_test.go | 3 +- go.mod | 50 +- go.sum | 40 ++ .../hybrid_deployment_agent.md.tmpl | 17 + .../hybrid_deployment_agents.md.tmpl | 16 + .../local_processing_agent.md.tmpl | 17 - .../local_processing_agents.md.tmpl | 16 - templates/data-sources/private_link.md.tmpl | 17 + templates/data-sources/private_links.md.tmpl | 16 + .../version_1.4.0_update_guides.md.tmpl | 64 +++ .../resources/hybrid_deployment_agent.md.tmpl | 21 + .../resources/local_processing_agent.md.tmpl | 20 - templates/resources/private_link.md.tmpl | 25 + 72 files changed, 2792 insertions(+), 1222 deletions(-) create mode 100644 docs/data-sources/hybrid_deployment_agent.md create mode 100644 docs/data-sources/hybrid_deployment_agents.md delete mode 100644 docs/data-sources/local_processing_agent.md delete mode 100644 docs/data-sources/local_processing_agents.md create mode 100644 docs/data-sources/private_link.md create mode 100644 docs/data-sources/private_links.md create mode 100644 docs/data-sources/private_links.md.tmpl create mode 100644 docs/guides/version_1.4.0_update_guides.md create mode 100644 docs/resources/hybrid_deployment_agent.md delete mode 100644 docs/resources/local_processing_agent.md create mode 100644 docs/resources/private_link.md rename fivetran/framework/core/model/{local_processing_agent.go => hybrid_deployment_agent.go} (57%) create mode 100644 fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go create mode 100644 fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go create mode 100644 fivetran/framework/core/model/hybrid_deployment_agents.go delete mode 100644 fivetran/framework/core/model/local_processing_agent_datasource_model.go delete mode 100644 fivetran/framework/core/model/local_processing_agent_resource_model.go delete mode 100644 fivetran/framework/core/model/local_processing_agents.go create mode 100644 fivetran/framework/core/model/private_link.go create mode 100644 fivetran/framework/core/model/private_links.go rename fivetran/framework/core/schema/{local_processing_agent.go => hybrid_deployment_agent.go} (50%) create mode 100644 fivetran/framework/core/schema/private_link.go rename fivetran/framework/datasources/{local_processing_agent.go => hybrid_deployment_agent.go} (54%) create mode 100644 fivetran/framework/datasources/hybrid_deployment_agent_test.go create mode 100644 fivetran/framework/datasources/hybrid_deployment_agents.go create mode 100644 fivetran/framework/datasources/hybrid_deployment_agents_test.go delete mode 100644 fivetran/framework/datasources/local_processing_agent_test.go delete mode 100644 fivetran/framework/datasources/local_processing_agents_test.go create mode 100644 fivetran/framework/datasources/private_link.go create mode 100644 fivetran/framework/datasources/private_link_test.go rename fivetran/framework/datasources/{local_processing_agents.go => private_links.go} (57%) create mode 100644 fivetran/framework/datasources/private_links_test.go rename fivetran/framework/resources/{local_processing_agent.go => hybrid_deployment_agent.go} (59%) create mode 100644 fivetran/framework/resources/hybrid_deployment_agent_test.go delete mode 100644 fivetran/framework/resources/local_processing_agent_test.go create mode 100644 fivetran/framework/resources/private_link.go create mode 100644 fivetran/framework/resources/private_link_test.go create mode 100644 fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go delete mode 100644 fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go create mode 100644 fivetran/tests/e2e/resource_private_link_e2e_test.go create mode 100644 templates/data-sources/hybrid_deployment_agent.md.tmpl create mode 100644 templates/data-sources/hybrid_deployment_agents.md.tmpl delete mode 100644 templates/data-sources/local_processing_agent.md.tmpl delete mode 100644 templates/data-sources/local_processing_agents.md.tmpl create mode 100644 templates/data-sources/private_link.md.tmpl create mode 100644 templates/data-sources/private_links.md.tmpl create mode 100644 templates/guides/version_1.4.0_update_guides.md.tmpl create mode 100644 templates/resources/hybrid_deployment_agent.md.tmpl delete mode 100644 templates/resources/local_processing_agent.md.tmpl create mode 100644 templates/resources/private_link.md.tmpl diff --git a/CHANGELOG.md b/CHANGELOG.md index d6f70331..90828dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,34 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.3.2...HEAD) +## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.4.0...HEAD) + +## [1.4.0](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.3.2...v1.4.0) + +## Added +- New resource `fivetran_private_link` that allows to manage Private Links. +- New data source `fivetran_private_link` that allows to retrieve details of the existing Private Link for a given identifier. +- New data source `fivetran_private_links` that allows to retrieve the list of existing Private Links available for the current account. + +Updates to support management of private links: +- Resource `fivetran_connector` updates: + - Added field `fivetran_connector.private_link_id`. + +- Resource `fivetran_destination` updates: + - Added field `fivetran_destination.private_link_id`. + +- Datasource `fivetran_connector` updates: + - Added field `fivetran_connector.private_link_id`. + +- Datasource `fivetran_destination` updates: + - Added field `fivetran_destination.private_link_id`. + +## Updated +- Resource `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent`. +- Data source `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent`. +- Data source `fivetran_local_processing_agents` renamed to `fivetran_hybrid_deployment_agents`. +- Field `fivetran_connector.local_processing_agent_id` renamed to `fivetran_connector.hybrid_deployment_id`. +- Field `fivetran_destination.local_processing_agent_id` renamed to `fivetran_destination.hybrid_deployment_id`. ## [1.3.2](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.3.1...v1.3.2) diff --git a/docs/data-sources/connector.md b/docs/data-sources/connector.md index b0bc4027..4ce4969b 100644 --- a/docs/data-sources/connector.md +++ b/docs/data-sources/connector.md @@ -30,11 +30,12 @@ data "fivetran_connector" "connector" { - `destination_schema` (Block, Read-only) (see [below for nested schema](#nestedblock--destination_schema)) - `failed_at` (String) The timestamp of the time the connector sync failed last time. - `group_id` (String) The unique identifier for the Group (Destination) within the Fivetran system. -- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `hybrid_deployment_agent_id` (String) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `name` (String) The name used both as the connector's name within the Fivetran system and as the source schema's name within your destination. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. - `pause_after_trial` (Boolean) Specifies whether the connector should be paused after the free trial period has ended. - `paused` (Boolean) Specifies whether the connector is paused. +- `private_link_id` (String) The private link ID. - `proxy_agent_id` (String) The proxy agent ID. - `schedule_type` (String) The connector schedule configuration type. Supported values: auto, manual. - `service` (String) The connector type id within the Fivetran system. diff --git a/docs/data-sources/destination.md b/docs/data-sources/destination.md index 9446c137..bc59d94a 100644 --- a/docs/data-sources/destination.md +++ b/docs/data-sources/destination.md @@ -26,8 +26,9 @@ data "fivetran_destination" "dest" { - `config` (Block, Read-only) (see [below for nested schema](#nestedblock--config)) - `daylight_saving_time_enabled` (Boolean) Shift my UTC offset with daylight savings time (US Only) - `group_id` (String) The unique identifier for the Group within the Fivetran system. -- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `hybrid_deployment_agent_id` (String) The lhybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. +- `private_link_id` (String) The private link ID. - `region` (String) Data processing location. This is where Fivetran will operate and run computation on data. - `service` (String) The destination type id within the Fivetran system. - `setup_status` (String) Destination setup status. diff --git a/docs/data-sources/hybrid_deployment_agent.md b/docs/data-sources/hybrid_deployment_agent.md new file mode 100644 index 00000000..ed3fda11 --- /dev/null +++ b/docs/data-sources/hybrid_deployment_agent.md @@ -0,0 +1,29 @@ +--- +page_title: "Data Source: fivetran_hybrid_deployment_agents" +--- + +# Data Source: fivetran_hybrid_deployment_agents + +This data source returns a hybrid deployment agent object. + +## Example Usage + +```hcl +data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agent" { + id = "hybrid_deployment_agent_id" +} +``` + + +## Schema + +### Required + +- `id` (String) The unique identifier for the hybrid deployment agent within your account. + +### Read-Only + +- `auth_type` (String) Type of authentification. Possible values `AUTO`,`MANUAL` +- `display_name` (String) The unique name for the hybrid deployment agent. +- `group_id` (String) The unique identifier for the Group within the Fivetran system. +- `registered_at` (String) The timestamp of the time the hybrid deployment agent was created in your account. \ No newline at end of file diff --git a/docs/data-sources/hybrid_deployment_agents.md b/docs/data-sources/hybrid_deployment_agents.md new file mode 100644 index 00000000..e84ec48f --- /dev/null +++ b/docs/data-sources/hybrid_deployment_agents.md @@ -0,0 +1,35 @@ +--- +page_title: "Data Source: fivetran_hybrid_deployment_agents" +--- + +# Data Source: fivetran_hybrid_deployment_agents + +This data source returns a list of all hybrid deployment agents within your Fivetran account. + +## Example Usage + +```hcl +data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agents" { +} +``` + + +## Schema + +### Read-Only + +- `items` (Attributes Set) (see [below for nested schema](#nestedatt--items)) + + +### Nested Schema for `items` + +Required: + +- `id` (String) The unique identifier for the hybrid deployment agent within your account. + +Read-Only: + +- `auth_type` (String) Type of authentification. Possible values `AUTO`,`MANUAL` +- `display_name` (String) The unique name for the hybrid deployment agent. +- `group_id` (String) The unique identifier for the Group within the Fivetran system. +- `registered_at` (String) The timestamp of the time the hybrid deployment agent was created in your account. \ No newline at end of file diff --git a/docs/data-sources/local_processing_agent.md b/docs/data-sources/local_processing_agent.md deleted file mode 100644 index ed8d65f4..00000000 --- a/docs/data-sources/local_processing_agent.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -page_title: "Data Source: fivetran_local_processing_agent" ---- - -# Data Source: fivetran_local_processing_agent - -This data source returns a local processing agent object. - -## Example Usage - -```hcl -data "fivetran_local_processing_agent" "local_processing_agent" { - id = "local_processing_agent_id" -} -``` - - -## Schema - -### Required - -- `id` (String) The unique identifier for the local processing agent within your account. - -### Read-Only - -- `display_name` (String) The unique name for the local processing agent. -- `group_id` (String) The unique identifier for the Group within the Fivetran system. -- `registered_at` (String) The timestamp of the time the local processing agent was created in your account. -- `usage` (Attributes Set) (see [below for nested schema](#nestedatt--usage)) - - -### Nested Schema for `usage` - -Read-Only: - -- `connection_id` (String) The unique identifier of the connection associated with the agent. -- `schema` (String) The connection schema name. -- `service` (String) The connection type. \ No newline at end of file diff --git a/docs/data-sources/local_processing_agents.md b/docs/data-sources/local_processing_agents.md deleted file mode 100644 index 2d0acf04..00000000 --- a/docs/data-sources/local_processing_agents.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -page_title: "Data Source: fivetran_local_processing_agents" ---- - -# Data Source: fivetran_local_processing_agents - -This data source returns a list of all local processing agents within your Fivetran account. - -## Example Usage - -```hcl -data "fivetran_local_processing_agents" "local_processing_agents" { -} -``` - - -## Schema - -### Read-Only - -- `items` (Attributes Set) (see [below for nested schema](#nestedatt--items)) - - -### Nested Schema for `items` - -Required: - -- `id` (String) The unique identifier for the local processing agent within your account. - -Read-Only: - -- `display_name` (String) The unique name for the local processing agent. -- `group_id` (String) The unique identifier for the Group within the Fivetran system. -- `registered_at` (String) The timestamp of the time the local processing agent was created in your account. -- `usage` (Attributes Set) (see [below for nested schema](#nestedatt--items--usage)) - - -### Nested Schema for `items.usage` - -Read-Only: - -- `connection_id` (String) The unique identifier of the connection associated with the agent. -- `schema` (String) The connection schema name. -- `service` (String) The connection type. \ No newline at end of file diff --git a/docs/data-sources/private_link.md b/docs/data-sources/private_link.md new file mode 100644 index 00000000..8788b99f --- /dev/null +++ b/docs/data-sources/private_link.md @@ -0,0 +1,54 @@ +--- +page_title: "Data Source: fivetran_private_link" +--- + +# Data Source: fivetran_private_link + +This data source returns a private link object. + +## Example Usage + +```hcl +data "fivetran_private_link" "private_link" { + id = "private_link_id" +} +``` + + +## Schema + +### Required + +- `id` (String) The unique identifier for the private link within the Fivetran system. + +### Optional + +- `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) + +### Read-Only + +- `cloud_provider` (String) The cloud provider name. +- `created_at` (String) The date and time the membership was created. +- `created_by` (String) The unique identifier for the User within the Fivetran system. +- `name` (String) The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters. +- `region` (String) Data processing location. This is where Fivetran will operate and run computation on data. +- `service` (String) Service type. +- `state` (String) The state of the private link. +- `state_summary` (String) The state of the private link. + + +### Nested Schema for `config` + +Optional: + +- `account_url` (String) The URL of your account. +- `aws_account_id` (String) The ID of your AWS account. +- `cluster_identifier` (String) The cluster identifier. +- `connection_service_id` (String) The ID of your connection service. +- `connection_service_name` (String) The name of your connection service. +- `pls_id` (String) The ID of your Azure Private Link service. +- `private_connection_service_id` (String) The ID of your connection service. +- `private_dns_regions` (String) Private DNS Regions. +- `sub_resource_name` (String) The name of subresource. +- `vpce_id` (String) The ID of your Virtual Private Cloud Endpoint. +- `workspace_url` (String) The URL of your workspace. \ No newline at end of file diff --git a/docs/data-sources/private_links.md b/docs/data-sources/private_links.md new file mode 100644 index 00000000..e0ad87fa --- /dev/null +++ b/docs/data-sources/private_links.md @@ -0,0 +1,35 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "fivetran_private_links Data Source - terraform-provider-fivetran" +subcategory: "" +description: |- + +--- + +# fivetran_private_links (Data Source) + + + + + + +## Schema + +### Read-Only + +- `items` (Block Set) (see [below for nested schema](#nestedblock--items)) + + +### Nested Schema for `items` + +Read-Only: + +- `cloud_provider` (String) The cloud provider name. +- `created_at` (String) The date and time the membership was created. +- `created_by` (String) The unique identifier for the User within the Fivetran system. +- `id` (String) The unique identifier for the private link within the Fivetran system. +- `name` (String) The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters. +- `region` (String) Data processing location. This is where Fivetran will operate and run computation on data. +- `service` (String) Service type. +- `state` (String) The state of the private link. +- `state_summary` (String) The state of the private link. diff --git a/docs/data-sources/private_links.md.tmpl b/docs/data-sources/private_links.md.tmpl new file mode 100644 index 00000000..7b7387c7 --- /dev/null +++ b/docs/data-sources/private_links.md.tmpl @@ -0,0 +1,16 @@ +--- +page_title: "Data Source: fivetran_private_links" +--- + +# Data Source: fivetran_private_links + +This data source returns a list of all private links within your Fivetran account. + +## Example Usage + +```hcl +data "fivetran_private_links" "private_links" { +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/docs/guides/version_1.4.0_update_guides.md b/docs/guides/version_1.4.0_update_guides.md new file mode 100644 index 00000000..46babea8 --- /dev/null +++ b/docs/guides/version_1.4.0_update_guides.md @@ -0,0 +1,64 @@ +---- +page_title: "Version Update 1.4.0" +subcategory: "Upgrade Guides" +--- + +# Version 1.4.0 + +## What's new in 1.4.0 + +In version `1.4.0` of Fivetran Terraform provider, resource `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent` + +## Migration guide + +### Provider + +Update your provider configuration in the following way: + +Previous configuration: + +```hcl +required_providers { + fivetran = { + version = "~> 1.3.0" + source = "fivetran/fivetran" + } + } +``` + +Updated configuration: + +```hcl +required_providers { + fivetran = { + version = ">= 1.4.0" + source = "fivetran/fivetran" + } + } +``` + +### Resource `fivetran_hybrid_deployment_agent` + +Update all your connector schema config resources (`fivetran_local_processing_agent`): + +Previous configuration: + +```hcl +resource "fivetran_local_processing_agent" "test_agent" { +} +``` + +Updated configuration: + +```hcl +resource "fivetran_hybrid_deployment_agent" "test_agent" { +} +``` + +### Update terraform state + +Once all configurations have been updated, run: + +``` +terraform init -upgrade +``` \ No newline at end of file diff --git a/docs/resources/connector.md b/docs/resources/connector.md index f1066d60..f4cfd818 100644 --- a/docs/resources/connector.md +++ b/docs/resources/connector.md @@ -70,8 +70,9 @@ resource "fivetran_connector" "amplitude" { - `auth` (Block, Optional) (see [below for nested schema](#nestedblock--auth)) - `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) - `destination_schema` (Block, Optional) (see [below for nested schema](#nestedblock--destination_schema)) -- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `hybrid_deployment_agent_id` (String) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. +- `private_link_id` (String) The private link ID. - `proxy_agent_id` (String) The proxy agent ID. - `run_setup_tests` (Boolean) Specifies whether the setup tests should be run automatically. The default value is FALSE. - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) diff --git a/docs/resources/connector_schema_config.md b/docs/resources/connector_schema_config.md index ed971658..190300ee 100644 --- a/docs/resources/connector_schema_config.md +++ b/docs/resources/connector_schema_config.md @@ -184,6 +184,7 @@ resource "fivetran_connector_schema_config" "schema" { - `schema_change_handling` (String) The value specifying how new source data is handled. - `schema` (Block Set, Deprecated) (see [below for nested schema](#nestedblock--schema)) +- `schema_change_handling` (String) The value specifying how new source data is handled. - `schemas` (Attributes Map) Map of schema configurations. (see [below for nested schema](#nestedatt--schemas)) - `schemas_json` (String) Schema settings in Json format, following Fivetran API endpoint contract for `schemas` field (a map of schemas). - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) diff --git a/docs/resources/destination.md b/docs/resources/destination.md index 70616211..f0ec06d4 100644 --- a/docs/resources/destination.md +++ b/docs/resources/destination.md @@ -48,8 +48,9 @@ resource "fivetran_destination" "dest" { - `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) - `daylight_saving_time_enabled` (Boolean) Shift my UTC offset with daylight savings time (US Only) -- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `hybrid_deployment_agent_id` (String) The lhybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. +- `private_link_id` (String) The private link ID. - `run_setup_tests` (Boolean) Specifies whether the setup tests should be run automatically. The default value is TRUE. - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) - `trust_certificates` (Boolean) Specifies whether we should trust the certificate automatically. The default value is FALSE. If a certificate is not trusted automatically, it has to be approved with [Certificates Management API Approve a destination certificate](https://fivetran.com/docs/rest-api/certificates#approveadestinationcertificate). diff --git a/docs/resources/hybrid_deployment_agent.md b/docs/resources/hybrid_deployment_agent.md new file mode 100644 index 00000000..2b4ea831 --- /dev/null +++ b/docs/resources/hybrid_deployment_agent.md @@ -0,0 +1,41 @@ +--- +page_title: "Resource: fivetran_hybrid_deployment_agent" +--- + +# Resource: fivetran_hybrid_deployment_agent + +This resource allows you to create, update, and delete hybrid deployment agents. + +## Example Usage + +```hcl +resource "fivetran_hybrid_deployment_agent" "hybrid_deployment_agent" { + provider = fivetran-provider + + display_name = "display_name" + group_id = "group_id" + auth_type = "AUTO" +} +``` + + +## Schema + +### Required + +- `auth_type` (String) Type of authentification. Possible values `AUTO`,`MANUAL` +- `display_name` (String) The unique name for the hybrid deployment agent. +- `group_id` (String) The unique identifier for the Group within the Fivetran system. + +### Optional + +- `authentication_counter` (Number) Determines whether re-authentication needs to be performed. + +### Read-Only + +- `auth_json` (String) Base64-encoded content of the auth.json file. +- `config_json` (String) Base64-encoded content of the config.json file. +- `docker_compose_yaml` (String) Base64-encoded content of the compose file for the chosen containerization type. +- `id` (String) The unique identifier for the hybrid deployment agent within your account. +- `registered_at` (String) The timestamp of the time the hybrid deployment agent was created in your account. +- `token` (String) Base64 encoded content of token. \ No newline at end of file diff --git a/docs/resources/local_processing_agent.md b/docs/resources/local_processing_agent.md deleted file mode 100644 index 50d33ace..00000000 --- a/docs/resources/local_processing_agent.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -page_title: "Resource: fivetran_local_processing_agent" ---- - -# Resource: fivetran_local_processing_agent - -This resource allows you to create, update, and delete local processing agents. - -## Example Usage - -```hcl -resource "fivetran_local_processing_agent" "test_lpa" { - provider = fivetran-provider - - display_name = "display_name" - group_id = "group_id" -} -``` - - -## Schema - -### Required - -- `display_name` (String) The unique name for the local processing agent. -- `group_id` (String) The unique identifier for the Group within the Fivetran system. - -### Optional - -- `authentication_counter` (Number) Determines whether re-authentication needs to be performed. - -### Read-Only - -- `auth_json` (String) Base64-encoded content of the auth.json file. -- `config_json` (String) Base64-encoded content of the config.json file. -- `docker_compose_yaml` (String) Base64-encoded content of the compose file for the chosen containerization type. -- `id` (String) The unique identifier for the local processing agent within your account. -- `registered_at` (String) The timestamp of the time the local processing agent was created in your account. -- `usage` (Attributes Set) (see [below for nested schema](#nestedatt--usage)) - - -### Nested Schema for `usage` - -Required: - -- `schema` (String) The connection schema name. -- `service` (String) The connection type. - -Read-Only: - -- `connection_id` (String) The unique identifier of the connection associated with the agent. \ No newline at end of file diff --git a/docs/resources/private_link.md b/docs/resources/private_link.md new file mode 100644 index 00000000..3b2f9dd8 --- /dev/null +++ b/docs/resources/private_link.md @@ -0,0 +1,62 @@ +--- +page_title: "Resource: fivetran_private_link" +--- + +# Resource: fivetran_private_link + +This resource allows you to create, update, and delete private links. + +## Example Usage + +```hcl +resource "fivetran_private_link" "test_pl" { + provider = fivetran-provider + + name = "name" + region = "region" + service = "service" + + config { + connection_service_name = "connection_service_name" + } +} +``` + + +## Schema + +### Required + +- `name` (String) The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters. +- `region` (String) Data processing location. This is where Fivetran will operate and run computation on data. +- `service` (String) Service type. + +### Optional + +- `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) + +### Read-Only + +- `cloud_provider` (String) The cloud provider name. +- `created_at` (String) The date and time the membership was created. +- `created_by` (String) The unique identifier for the User within the Fivetran system. +- `id` (String) The unique identifier for the private link within the Fivetran system. +- `state` (String) The state of the private link. +- `state_summary` (String) The state of the private link. + + +### Nested Schema for `config` + +Optional: + +- `account_url` (String) The URL of your account. +- `aws_account_id` (String) The ID of your AWS account. +- `cluster_identifier` (String) The cluster identifier. +- `connection_service_id` (String) The ID of your connection service. +- `connection_service_name` (String) The name of your connection service. +- `pls_id` (String) The ID of your Azure Private Link service. +- `private_connection_service_id` (String) The ID of your connection service. +- `private_dns_regions` (String) Private DNS Regions. +- `sub_resource_name` (String) The name of subresource. +- `vpce_id` (String) The ID of your Virtual Private Cloud Endpoint. +- `workspace_url` (String) The URL of your workspace. diff --git a/fivetran/framework/core/core.go b/fivetran/framework/core/core.go index f7c300d3..34f93dde 100644 --- a/fivetran/framework/core/core.go +++ b/fivetran/framework/core/core.go @@ -13,8 +13,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" datasourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" diff --git a/fivetran/framework/core/model/connector.go b/fivetran/framework/core/model/connector.go index 54087bfc..bed6e82f 100644 --- a/fivetran/framework/core/model/connector.go +++ b/fivetran/framework/core/model/connector.go @@ -1,191 +1,194 @@ package model import ( - "fmt" - "strings" - - gfcommon "github.com/fivetran/go-fivetran/common" - "github.com/fivetran/go-fivetran/connectors" - "github.com/fivetran/terraform-provider-fivetran/fivetran/common" - "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "fmt" + "strings" + + gfcommon "github.com/fivetran/go-fivetran/common" + "github.com/fivetran/go-fivetran/connectors" + "github.com/fivetran/terraform-provider-fivetran/fivetran/common" + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type ConnectorDatasourceModel struct { - Id types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - ConnectedBy types.String `tfsdk:"connected_by"` - CreatedAt types.String `tfsdk:"created_at"` - GroupId types.String `tfsdk:"group_id"` - Service types.String `tfsdk:"service"` - - DestinationSchema types.Object `tfsdk:"destination_schema"` - - SucceededAt types.String `tfsdk:"succeeded_at"` - FailedAt types.String `tfsdk:"failed_at"` - ServiceVersion types.String `tfsdk:"service_version"` - SyncFrequency types.Int64 `tfsdk:"sync_frequency"` - ScheduleType types.String `tfsdk:"schedule_type"` - Paused types.Bool `tfsdk:"paused"` - PauseAfterTrial types.Bool `tfsdk:"pause_after_trial"` - DailySyncTime types.String `tfsdk:"daily_sync_time"` - - ProxyAgentId types.String `tfsdk:"proxy_agent_id"` - NetworkingMethod types.String `tfsdk:"networking_method"` - LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` - - Status types.Object `tfsdk:"status"` - - Config types.Object `tfsdk:"config"` + Id types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + ConnectedBy types.String `tfsdk:"connected_by"` + CreatedAt types.String `tfsdk:"created_at"` + GroupId types.String `tfsdk:"group_id"` + Service types.String `tfsdk:"service"` + + DestinationSchema types.Object `tfsdk:"destination_schema"` + + SucceededAt types.String `tfsdk:"succeeded_at"` + FailedAt types.String `tfsdk:"failed_at"` + ServiceVersion types.String `tfsdk:"service_version"` + SyncFrequency types.Int64 `tfsdk:"sync_frequency"` + ScheduleType types.String `tfsdk:"schedule_type"` + Paused types.Bool `tfsdk:"paused"` + PauseAfterTrial types.Bool `tfsdk:"pause_after_trial"` + DailySyncTime types.String `tfsdk:"daily_sync_time"` + + ProxyAgentId types.String `tfsdk:"proxy_agent_id"` + NetworkingMethod types.String `tfsdk:"networking_method"` + HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` + PrivateLinkId types.String `tfsdk:"private_link_id"` + + Status types.Object `tfsdk:"status"` + + Config types.Object `tfsdk:"config"` } var ( - codeMessageAttrTypes = map[string]attr.Type{ - "code": types.StringType, - "message": types.StringType, - } + codeMessageAttrTypes = map[string]attr.Type{ + "code": types.StringType, + "message": types.StringType, + } ) func (d *ConnectorDatasourceModel) ReadFromResponse(resp connectors.DetailsWithCustomConfigNoTestsResponse) { - responseContainer := ConnectorModelContainer{} - responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) - d.ReadFromContainer(responseContainer) - - d.SucceededAt = types.StringValue(resp.Data.SucceededAt.String()) - d.FailedAt = types.StringValue(resp.Data.FailedAt.String()) - d.ServiceVersion = types.StringValue(fmt.Sprintf("%v", *resp.Data.ServiceVersion)) - d.SyncFrequency = types.Int64Value(int64(*resp.Data.SyncFrequency)) - d.ScheduleType = types.StringValue(resp.Data.ScheduleType) - d.Paused = types.BoolValue(*resp.Data.Paused) - d.PauseAfterTrial = types.BoolValue(*resp.Data.PauseAfterTrial) - if resp.Data.DailySyncTime != "" { - d.DailySyncTime = types.StringValue(resp.Data.DailySyncTime) - } else { - d.DailySyncTime = types.StringNull() - } - - codeMessageAttrType := types.ObjectType{ - AttrTypes: codeMessageAttrTypes, - } - - warns := []attr.Value{} - for _, w := range resp.Data.Status.Warnings { - warns = append(warns, readCommonResponse(w)) - } - tasks := []attr.Value{} - for _, t := range resp.Data.Status.Tasks { - tasks = append(tasks, readCommonResponse(t)) - } - - wsV, _ := types.SetValue(codeMessageAttrType, warns) - tsV, _ := types.SetValue(codeMessageAttrType, tasks) - - status, _ := types.ObjectValue( - map[string]attr.Type{ - "setup_state": types.StringType, - "is_historical_sync": types.BoolType, - "sync_state": types.StringType, - "update_state": types.StringType, - "tasks": types.SetType{ElemType: codeMessageAttrType}, - "warnings": types.SetType{ElemType: codeMessageAttrType}, - }, - map[string]attr.Value{ - "setup_state": types.StringValue(resp.Data.Status.SetupState), - "is_historical_sync": types.BoolPointerValue(resp.Data.Status.IsHistoricalSync), - "sync_state": types.StringValue(resp.Data.Status.SyncState), - "update_state": types.StringValue(resp.Data.Status.UpdateState), - "warnings": wsV, - "tasks": tsV, - }, - ) - d.Status = status + responseContainer := ConnectorModelContainer{} + responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) + d.ReadFromContainer(responseContainer) + + d.SucceededAt = types.StringValue(resp.Data.SucceededAt.String()) + d.FailedAt = types.StringValue(resp.Data.FailedAt.String()) + d.ServiceVersion = types.StringValue(fmt.Sprintf("%v", *resp.Data.ServiceVersion)) + d.SyncFrequency = types.Int64Value(int64(*resp.Data.SyncFrequency)) + d.ScheduleType = types.StringValue(resp.Data.ScheduleType) + d.Paused = types.BoolValue(*resp.Data.Paused) + d.PauseAfterTrial = types.BoolValue(*resp.Data.PauseAfterTrial) + + if resp.Data.DailySyncTime != "" { + d.DailySyncTime = types.StringValue(resp.Data.DailySyncTime) + } else { + d.DailySyncTime = types.StringNull() + } + + codeMessageAttrType := types.ObjectType{ + AttrTypes: codeMessageAttrTypes, + } + + warns := []attr.Value{} + for _, w := range resp.Data.Status.Warnings { + warns = append(warns, readCommonResponse(w)) + } + tasks := []attr.Value{} + for _, t := range resp.Data.Status.Tasks { + tasks = append(tasks, readCommonResponse(t)) + } + + wsV, _ := types.SetValue(codeMessageAttrType, warns) + tsV, _ := types.SetValue(codeMessageAttrType, tasks) + + status, _ := types.ObjectValue( + map[string]attr.Type{ + "setup_state": types.StringType, + "is_historical_sync": types.BoolType, + "sync_state": types.StringType, + "update_state": types.StringType, + "tasks": types.SetType{ElemType: codeMessageAttrType}, + "warnings": types.SetType{ElemType: codeMessageAttrType}, + }, + map[string]attr.Value{ + "setup_state": types.StringValue(resp.Data.Status.SetupState), + "is_historical_sync": types.BoolPointerValue(resp.Data.Status.IsHistoricalSync), + "sync_state": types.StringValue(resp.Data.Status.SyncState), + "update_state": types.StringValue(resp.Data.Status.UpdateState), + "warnings": wsV, + "tasks": tsV, + }, + ) + d.Status = status } func readCommonResponse(r gfcommon.CommonResponse) attr.Value { - result, _ := types.ObjectValue(codeMessageAttrTypes, - map[string]attr.Value{ - "code": types.StringValue(r.Code), - "message": types.StringValue(r.Message), - }) - return result + result, _ := types.ObjectValue(codeMessageAttrTypes, + map[string]attr.Value{ + "code": types.StringValue(r.Code), + "message": types.StringValue(r.Message), + }) + return result } type ConnectorResourceModel struct { - Id types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - ConnectedBy types.String `tfsdk:"connected_by"` - CreatedAt types.String `tfsdk:"created_at"` - GroupId types.String `tfsdk:"group_id"` - Service types.String `tfsdk:"service"` - DestinationSchema types.Object `tfsdk:"destination_schema"` - - ProxyAgentId types.String `tfsdk:"proxy_agent_id"` - NetworkingMethod types.String `tfsdk:"networking_method"` - LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` - - Config types.Object `tfsdk:"config"` - Auth types.Object `tfsdk:"auth"` - Timeouts timeouts.Value `tfsdk:"timeouts"` - - RunSetupTests types.Bool `tfsdk:"run_setup_tests"` - TrustCertificates types.Bool `tfsdk:"trust_certificates"` - TrustFingerprints types.Bool `tfsdk:"trust_fingerprints"` + Id types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + ConnectedBy types.String `tfsdk:"connected_by"` + CreatedAt types.String `tfsdk:"created_at"` + GroupId types.String `tfsdk:"group_id"` + Service types.String `tfsdk:"service"` + DestinationSchema types.Object `tfsdk:"destination_schema"` + + ProxyAgentId types.String `tfsdk:"proxy_agent_id"` + NetworkingMethod types.String `tfsdk:"networking_method"` + HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` + PrivateLinkId types.String `tfsdk:"private_link_id"` + + Config types.Object `tfsdk:"config"` + Auth types.Object `tfsdk:"auth"` + Timeouts timeouts.Value `tfsdk:"timeouts"` + + RunSetupTests types.Bool `tfsdk:"run_setup_tests"` + TrustCertificates types.Bool `tfsdk:"trust_certificates"` + TrustFingerprints types.Bool `tfsdk:"trust_fingerprints"` } func (d *ConnectorResourceModel) ReadFromResponse(resp connectors.DetailsWithCustomConfigNoTestsResponse, forceReadConfig bool) diag.Diagnostics { - responseContainer := ConnectorModelContainer{} - responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) - d.ReadFromContainer(responseContainer, forceReadConfig) - return nil + responseContainer := ConnectorModelContainer{} + responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) + d.ReadFromContainer(responseContainer, forceReadConfig) + return nil } func (d *ConnectorResourceModel) ReadFromCreateResponse(resp connectors.DetailsWithCustomConfigResponse) diag.Diagnostics { - responseContainer := ConnectorModelContainer{} - responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) - d.ReadFromContainer(responseContainer, false) - return nil + responseContainer := ConnectorModelContainer{} + responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) + d.ReadFromContainer(responseContainer, false) + return nil } func (d *ConnectorResourceModel) GetConfigMap(nullOnNull bool) (map[string]interface{}, error) { - if d.Config.IsNull() && nullOnNull { - return nil, nil - } - result := getValueFromAttrValue(d.Config, common.GetConfigFieldsMap(), nil, d.Service.ValueString()).(map[string]interface{}) - serviceName := d.Service.ValueString() - serviceFields, err := common.GetFieldsForService(serviceName) - if err != nil { - return result, err - } - allFields := common.GetConfigFieldsMap() - err = patchServiceSpecificFields(result, serviceName, serviceFields, allFields) - return result, err + if d.Config.IsNull() && nullOnNull { + return nil, nil + } + result := getValueFromAttrValue(d.Config, common.GetConfigFieldsMap(), nil, d.Service.ValueString()).(map[string]interface{}) + serviceName := d.Service.ValueString() + serviceFields, err := common.GetFieldsForService(serviceName) + if err != nil { + return result, err + } + allFields := common.GetConfigFieldsMap() + err = patchServiceSpecificFields(result, serviceName, serviceFields, allFields) + return result, err } func (d *ConnectorResourceModel) GetAuthMap(nullOnNull bool) (map[string]interface{}, error) { - if d.Auth.IsNull() && nullOnNull { - return nil, nil - } - serviceName := d.Service.ValueString() - serviceFields := common.GetAuthFieldsForService(serviceName) - allFields := common.GetAuthFieldsMap() - - result := getValueFromAttrValue(d.Auth, allFields, nil, serviceName).(map[string]interface{}) - err := patchServiceSpecificFields(result, serviceName, serviceFields, allFields) - return result, err + if d.Auth.IsNull() && nullOnNull { + return nil, nil + } + serviceName := d.Service.ValueString() + serviceFields := common.GetAuthFieldsForService(serviceName) + allFields := common.GetAuthFieldsMap() + + result := getValueFromAttrValue(d.Auth, allFields, nil, serviceName).(map[string]interface{}) + err := patchServiceSpecificFields(result, serviceName, serviceFields, allFields) + return result, err } func (d *ConnectorResourceModel) GetDestinatonSchemaForConfig() (map[string]interface{}, error) { - if d.DestinationSchema.IsNull() || d.DestinationSchema.IsUnknown() { - return nil, fmt.Errorf("Field `destination_schema` is required.") - } - return getDestinatonSchemaForConfig(d.Service, - d.DestinationSchema.Attributes()["name"], - d.DestinationSchema.Attributes()["table"], - d.DestinationSchema.Attributes()["prefix"], - ) + if d.DestinationSchema.IsNull() || d.DestinationSchema.IsUnknown() { + return nil, fmt.Errorf("Field `destination_schema` is required.") + } + return getDestinatonSchemaForConfig(d.Service, + d.DestinationSchema.Attributes()["name"], + d.DestinationSchema.Attributes()["table"], + d.DestinationSchema.Attributes()["prefix"], + ) } func (d *ConnectorResourceModel) ReadFromContainer(c ConnectorModelContainer, forceReadConfig bool) { @@ -196,13 +199,17 @@ func (d *ConnectorResourceModel) ReadFromContainer(c ConnectorModelContainer, fo d.GroupId = types.StringValue(c.GroupId) d.Service = types.StringValue(c.Service) - if c.LocalProcessingAgentId != "" { - d.LocalProcessingAgentId = types.StringValue(c.LocalProcessingAgentId) + if c.HybridDeploymentAgentId != "" { + d.HybridDeploymentAgentId = types.StringValue(c.HybridDeploymentAgentId) } else { - d.LocalProcessingAgentId = types.StringNull() + d.HybridDeploymentAgentId = types.StringNull() } - d.DestinationSchema = getDestinationSchemaValue(c.Service, c.Schema) + if c.PrivateLinkId != "" { + d.PrivateLinkId = types.StringValue(c.PrivateLinkId) + } else { + d.PrivateLinkId = types.StringNull() + } if c.ProxyAgentId != "" { d.ProxyAgentId = types.StringValue(c.ProxyAgentId) @@ -224,20 +231,18 @@ func (d *ConnectorResourceModel) ReadFromContainer(c ConnectorModelContainer, fo } func (d *ConnectorDatasourceModel) ReadFromContainer(c ConnectorModelContainer) { - d.Id = types.StringValue(c.Id) - d.Name = types.StringValue(c.Schema) - d.ConnectedBy = types.StringValue(c.ConnectedBy) - d.CreatedAt = types.StringValue(c.CreatedAt) - d.GroupId = types.StringValue(c.GroupId) - d.Service = types.StringValue(c.Service) - - if c.LocalProcessingAgentId != "" { - d.LocalProcessingAgentId = types.StringValue(c.LocalProcessingAgentId) - } else { - d.LocalProcessingAgentId = types.StringNull() - } - - d.DestinationSchema = getDestinationSchemaValue(c.Service, c.Schema) + d.Id = types.StringValue(c.Id) + d.Name = types.StringValue(c.Schema) + d.ConnectedBy = types.StringValue(c.ConnectedBy) + d.CreatedAt = types.StringValue(c.CreatedAt) + d.GroupId = types.StringValue(c.GroupId) + d.Service = types.StringValue(c.Service) + + if c.PrivateLinkId != "" { + d.PrivateLinkId = types.StringValue(c.PrivateLinkId) + } else { + d.PrivateLinkId = types.StringNull() + } if c.ProxyAgentId != "" { d.ProxyAgentId = types.StringValue(c.ProxyAgentId) @@ -249,33 +254,42 @@ func (d *ConnectorDatasourceModel) ReadFromContainer(c ConnectorModelContainer) d.NetworkingMethod = types.StringValue(c.NetworkingMethod) } - d.Config = getValue( - types.ObjectType{AttrTypes: getAttrTypes(common.GetConfigFieldsMap())}, - c.Config, - c.Config, - common.GetConfigFieldsMap(), - nil, - c.Service).(basetypes.ObjectValue) + if c.HybridDeploymentAgentId != "" { + d.HybridDeploymentAgentId = types.StringValue(c.HybridDeploymentAgentId) + } else { + d.HybridDeploymentAgentId = types.StringNull() + } + + d.DestinationSchema = getDestinationSchemaValue(c.Service, c.Schema) + + d.Config = getValue( + types.ObjectType{AttrTypes: getAttrTypes(common.GetConfigFieldsMap())}, + c.Config, + c.Config, + common.GetConfigFieldsMap(), + nil, + c.Service).(basetypes.ObjectValue) } type ConnectorModelContainer struct { - Id string - Name string - ConnectedBy string - CreatedAt string - GroupId string - Service string - Schema string - - ProxyAgentId string - NetworkingMethod string - LocalProcessingAgentId string + Id string + Name string + ConnectedBy string + CreatedAt string + GroupId string + Service string + Schema string + + ProxyAgentId string + NetworkingMethod string + HybridDeploymentAgentId string + PrivateLinkId string Config map[string]interface{} - RunSetupTests bool - TrustCertificates bool - TrustFingerprints bool + RunSetupTests bool + TrustCertificates bool + TrustFingerprints bool } func (c *ConnectorModelContainer) ReadFromResponseData(data connectors.DetailsResponseDataCommon, config map[string]interface{}) { @@ -296,9 +310,13 @@ func (c *ConnectorModelContainer) ReadFromResponseData(data connectors.DetailsRe c.NetworkingMethod = data.NetworkingMethod } - if data.LocalProcessingAgentId != "" { - c.LocalProcessingAgentId = data.LocalProcessingAgentId - } + if data.HybridDeploymentAgentId != "" { + c.HybridDeploymentAgentId = data.HybridDeploymentAgentId + } + + if data.PrivateLinkId != "" { + c.PrivateLinkId = data.PrivateLinkId + } } func getDestinatonSchemaForConfig(serviceId, nameAttr, tableAttr, prefixAttr attr.Value) (map[string]interface{}, error) { @@ -337,38 +355,38 @@ func getDestinatonSchemaForConfig(serviceId, nameAttr, tableAttr, prefixAttr att } func getDestinationSchemaValue(service, schema string) types.Object { - r, _ := types.ObjectValue( - map[string]attr.Type{ - "name": types.StringType, - "table": types.StringType, - "prefix": types.StringType, - }, - getDestinationSchemaValuesMap(service, schema), - ) - return r + r, _ := types.ObjectValue( + map[string]attr.Type{ + "name": types.StringType, + "table": types.StringType, + "prefix": types.StringType, + }, + getDestinationSchemaValuesMap(service, schema), + ) + return r } func getDestinationSchemaValuesMap(service, schema string) map[string]attr.Value { - if _, ok := common.GetDestinationSchemaFields()[service]; !ok { - panic(fmt.Errorf("unknown connector service: `%v`", service)) - } - - if common.GetDestinationSchemaFields()[service]["schema_prefix"] { - return map[string]attr.Value{ - "name": types.StringNull(), - "table": types.StringNull(), - "prefix": types.StringValue(schema), - } - } else { - result := map[string]attr.Value{ - "table": types.StringNull(), - "prefix": types.StringNull(), - } - s := strings.Split(schema, ".") - result["name"] = types.StringValue(s[0]) - if len(s) > 1 && common.GetDestinationSchemaFields()[service]["table"] { - result["table"] = types.StringValue(s[1]) - } - return result - } + if _, ok := common.GetDestinationSchemaFields()[service]; !ok { + panic(fmt.Errorf("unknown connector service: `%v`", service)) + } + + if common.GetDestinationSchemaFields()[service]["schema_prefix"] { + return map[string]attr.Value{ + "name": types.StringNull(), + "table": types.StringNull(), + "prefix": types.StringValue(schema), + } + } else { + result := map[string]attr.Value{ + "table": types.StringNull(), + "prefix": types.StringNull(), + } + s := strings.Split(schema, ".") + result["name"] = types.StringValue(s[0]) + if len(s) > 1 && common.GetDestinationSchemaFields()[service]["table"] { + result["table"] = types.StringValue(s[1]) + } + return result + } } diff --git a/fivetran/framework/core/model/destination.go b/fivetran/framework/core/model/destination.go index 1b6e9838..7a6f966a 100644 --- a/fivetran/framework/core/model/destination.go +++ b/fivetran/framework/core/model/destination.go @@ -12,8 +12,9 @@ type destinationModel interface { SetTimeZonOffset(string) SetSetupStatus(string) SetDaylightSavingTimeEnabled(bool) - SetLocalProcessingAgentId(string) + SetHybridDeploymentAgentId(string) SetNetworkingMethod(string) + SetPrivateLinkId(string) SetConfig(map[string]interface{}) } @@ -25,7 +26,8 @@ func readFromResponse(d destinationModel, resp destinations.DestinationDetailsBa d.SetSetupStatus(resp.SetupStatus) d.SetTimeZonOffset(resp.TimeZoneOffset) d.SetDaylightSavingTimeEnabled(resp.DaylightSavingTimeEnabled) - d.SetLocalProcessingAgentId(resp.LocalProcessingAgentId) + d.SetHybridDeploymentAgentId(resp.HybridDeploymentAgentId) d.SetNetworkingMethod(resp.NetworkingMethod) + d.SetPrivateLinkId(resp.PrivateLinkId) d.SetConfig(config) } diff --git a/fivetran/framework/core/model/destination_datasource_model.go b/fivetran/framework/core/model/destination_datasource_model.go index 83fc76b5..ce43cfaa 100644 --- a/fivetran/framework/core/model/destination_datasource_model.go +++ b/fivetran/framework/core/model/destination_datasource_model.go @@ -1,10 +1,10 @@ package model import ( - "github.com/fivetran/go-fivetran/destinations" - "github.com/fivetran/terraform-provider-fivetran/fivetran/common" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/fivetran/go-fivetran/destinations" + "github.com/fivetran/terraform-provider-fivetran/fivetran/common" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type DestinationDatasourceModel struct { @@ -15,39 +15,47 @@ type DestinationDatasourceModel struct { TimeZoneOffset types.String `tfsdk:"time_zone_offset"` SetupStatus types.String `tfsdk:"setup_status"` DaylightSavingTimeEnabled types.Bool `tfsdk:"daylight_saving_time_enabled"` - LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` + HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` NetworkingMethod types.String `tfsdk:"networking_method"` + PrivateLinkId types.String `tfsdk:"private_link_id"` Config types.Object `tfsdk:"config"` } var _ destinationModel = &DestinationDatasourceModel{} func (d *DestinationDatasourceModel) SetId(value string) { - d.Id = types.StringValue(value) + d.Id = types.StringValue(value) } func (d *DestinationDatasourceModel) SetGroupId(value string) { - d.GroupId = types.StringValue(value) + d.GroupId = types.StringValue(value) } func (d *DestinationDatasourceModel) SetService(value string) { - d.Service = types.StringValue(value) + d.Service = types.StringValue(value) } func (d *DestinationDatasourceModel) SetRegion(value string) { - d.Region = types.StringValue(value) + d.Region = types.StringValue(value) } func (d *DestinationDatasourceModel) SetTimeZonOffset(value string) { - d.TimeZoneOffset = types.StringValue(value) + d.TimeZoneOffset = types.StringValue(value) } func (d *DestinationDatasourceModel) SetSetupStatus(value string) { - d.SetupStatus = types.StringValue(value) + d.SetupStatus = types.StringValue(value) } func (d *DestinationDatasourceModel) SetDaylightSavingTimeEnabled(value bool) { - d.DaylightSavingTimeEnabled = types.BoolValue(value) + d.DaylightSavingTimeEnabled = types.BoolValue(value) } -func (d *DestinationDatasourceModel) SetLocalProcessingAgentId(value string) { +func (d *DestinationDatasourceModel) SetPrivateLinkId(value string) { if value != "" { - d.LocalProcessingAgentId = types.StringValue(value) + d.PrivateLinkId = types.StringValue(value) } else { - d.LocalProcessingAgentId = types.StringNull() + d.PrivateLinkId = types.StringNull() + } +} +func (d *DestinationDatasourceModel) SetHybridDeploymentAgentId(value string) { + if value != "" { + d.HybridDeploymentAgentId = types.StringValue(value) + } else { + d.HybridDeploymentAgentId = types.StringNull() } } func (d *DestinationDatasourceModel) SetNetworkingMethod(value string) { @@ -56,24 +64,24 @@ func (d *DestinationDatasourceModel) SetNetworkingMethod(value string) { } } func (d *DestinationDatasourceModel) SetConfig(value map[string]interface{}) { - if d.Service.IsNull() || d.Service.IsUnknown() { - panic("Service type is null. Can't handle config without service type.") - } - // WA for inconsistent BQ response - it returns just "location" instead of "data_set_location" - if l, ok := value["location"]; ok { - value["data_set_location"] = l - } - service := d.Service.ValueString() - d.Config = getValue( - types.ObjectType{AttrTypes: getAttrTypes(common.GetDestinationFieldsMap())}, - value, - value, - common.GetDestinationFieldsMap(), - nil, - service).(basetypes.ObjectValue) + if d.Service.IsNull() || d.Service.IsUnknown() { + panic("Service type is null. Can't handle config without service type.") + } + // WA for inconsistent BQ response - it returns just "location" instead of "data_set_location" + if l, ok := value["location"]; ok { + value["data_set_location"] = l + } + service := d.Service.ValueString() + d.Config = getValue( + types.ObjectType{AttrTypes: getAttrTypes(common.GetDestinationFieldsMap())}, + value, + value, + common.GetDestinationFieldsMap(), + nil, + service).(basetypes.ObjectValue) } func (d *DestinationDatasourceModel) ReadFromResponse(resp destinations.DestinationDetailsCustomResponse) { - var model destinationModel = d - readFromResponse(model, resp.Data.DestinationDetailsBase, resp.Data.Config) + var model destinationModel = d + readFromResponse(model, resp.Data.DestinationDetailsBase, resp.Data.Config) } diff --git a/fivetran/framework/core/model/destination_resource_model.go b/fivetran/framework/core/model/destination_resource_model.go index 34136a45..a9738e62 100644 --- a/fivetran/framework/core/model/destination_resource_model.go +++ b/fivetran/framework/core/model/destination_resource_model.go @@ -18,8 +18,9 @@ type DestinationResourceModel struct { DaylightSavingTimeEnabled types.Bool `tfsdk:"daylight_saving_time_enabled"` Config types.Object `tfsdk:"config"` Timeouts timeouts.Value `tfsdk:"timeouts"` - LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` + HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` NetworkingMethod types.String `tfsdk:"networking_method"` + PrivateLinkId types.String `tfsdk:"private_link_id"` RunSetupTests types.Bool `tfsdk:"run_setup_tests"` TrustCertificates types.Bool `tfsdk:"trust_certificates"` @@ -49,11 +50,12 @@ func (d *DestinationResourceModel) SetSetupStatus(value string) { func (d *DestinationResourceModel) SetDaylightSavingTimeEnabled(value bool) { d.DaylightSavingTimeEnabled = types.BoolValue(value) } -func (d *DestinationResourceModel) SetLocalProcessingAgentId(value string) { + +func (d *DestinationResourceModel) SetHybridDeploymentAgentId(value string) { if value != "" { - d.LocalProcessingAgentId = types.StringValue(value) + d.HybridDeploymentAgentId = types.StringValue(value) } else { - d.LocalProcessingAgentId = types.StringNull() + d.HybridDeploymentAgentId = types.StringNull() } } func (d *DestinationResourceModel) SetNetworkingMethod(value string) { @@ -61,6 +63,13 @@ func (d *DestinationResourceModel) SetNetworkingMethod(value string) { d.NetworkingMethod = types.StringValue(value) } } +func (d *DestinationResourceModel) SetPrivateLinkId(value string) { + if value != "" { + d.PrivateLinkId = types.StringValue(value) + } else { + d.PrivateLinkId = types.StringNull() + } +} func (d *DestinationResourceModel) SetConfig(value map[string]interface{}) { if d.Service.IsNull() || d.Service.IsUnknown() { panic("Service type is null. Can't handle config without service type.") diff --git a/fivetran/framework/core/model/local_processing_agent.go b/fivetran/framework/core/model/hybrid_deployment_agent.go similarity index 57% rename from fivetran/framework/core/model/local_processing_agent.go rename to fivetran/framework/core/model/hybrid_deployment_agent.go index 1acbce32..4abbf7b6 100644 --- a/fivetran/framework/core/model/local_processing_agent.go +++ b/fivetran/framework/core/model/hybrid_deployment_agent.go @@ -1,10 +1,10 @@ package model import ( - "github.com/fivetran/go-fivetran/local_processing_agent" + "github.com/fivetran/go-fivetran/hybrid_deployment_agent" ) -type localProcessingAgentModel interface { +type hybridDeploymentAgentModel interface { SetId(string) SetDisplayName(string) SetGroupId(string) @@ -12,18 +12,16 @@ type localProcessingAgentModel interface { SetConfigJson(string) SetAuthJson(string) SetDockerComposeYaml(string) - SetUsage([]localprocessingagent.LocalProcessingAgentUsageDetails) } -func readLocalProcessingAgentFromResponse(d localProcessingAgentModel, resp localprocessingagent.LocalProcessingAgentDetailsResponse) { +func readHybridDeploymentAgentFromResponse(d hybridDeploymentAgentModel, resp hybriddeploymentagent.HybridDeploymentAgentDetailsResponse) { d.SetId(resp.Data.Id) d.SetDisplayName(resp.Data.DisplayName) d.SetGroupId(resp.Data.GroupId) d.SetRegisteredAt(resp.Data.RegisteredAt) - d.SetUsage(resp.Data.Usage) } -func readLocalProcessingAgentFromCreateResponse(d localProcessingAgentModel, resp localprocessingagent.LocalProcessingAgentCreateResponse) { +func readHybridDeploymentAgentFromCreateResponse(d hybridDeploymentAgentModel, resp hybriddeploymentagent.HybridDeploymentAgentCreateResponse) { d.SetId(resp.Data.Id) d.SetDisplayName(resp.Data.DisplayName) d.SetGroupId(resp.Data.GroupId) @@ -31,5 +29,4 @@ func readLocalProcessingAgentFromCreateResponse(d localProcessingAgentModel, res d.SetConfigJson(resp.Data.Files.ConfigJson) d.SetAuthJson(resp.Data.Files.AuthJson) d.SetDockerComposeYaml(resp.Data.Files.DockerComposeYaml) - d.SetUsage(nil) } \ No newline at end of file diff --git a/fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go b/fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go new file mode 100644 index 00000000..d2ded455 --- /dev/null +++ b/fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go @@ -0,0 +1,36 @@ +package model + +import ( + "github.com/fivetran/go-fivetran/hybrid_deployment_agent" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +type HybridDeploymentAgentDatasourceModel struct { + Id types.String `tfsdk:"id"` + DisplayName types.String `tfsdk:"display_name"` + GroupId types.String `tfsdk:"group_id"` + RegisteredAt types.String `tfsdk:"registered_at"` +} + +var _ hybridDeploymentAgentModel = &HybridDeploymentAgentDatasourceModel{} + +func (d *HybridDeploymentAgentDatasourceModel) SetId(value string) { + d.Id = types.StringValue(value) +} +func (d *HybridDeploymentAgentDatasourceModel) SetGroupId(value string) { + d.GroupId = types.StringValue(value) +} +func (d *HybridDeploymentAgentDatasourceModel) SetDisplayName(value string) { + d.DisplayName = types.StringValue(value) +} +func (d *HybridDeploymentAgentDatasourceModel) SetRegisteredAt(value string) { + d.RegisteredAt = types.StringValue(value) +} +func (d *HybridDeploymentAgentDatasourceModel) SetConfigJson(value string) {} +func (d *HybridDeploymentAgentDatasourceModel) SetAuthJson(value string) {} +func (d *HybridDeploymentAgentDatasourceModel) SetDockerComposeYaml(value string) {} + +func (d *HybridDeploymentAgentDatasourceModel) ReadFromResponse(resp hybriddeploymentagent.HybridDeploymentAgentDetailsResponse) { + var model hybridDeploymentAgentModel = d + readHybridDeploymentAgentFromResponse(model, resp) +} \ No newline at end of file diff --git a/fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go b/fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go new file mode 100644 index 00000000..52471db5 --- /dev/null +++ b/fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go @@ -0,0 +1,51 @@ +package model + +import ( + "github.com/fivetran/go-fivetran/hybrid_deployment_agent" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +type HybridDeploymentAgentResourceModel struct { + Id types.String `tfsdk:"id"` + DisplayName types.String `tfsdk:"display_name"` + GroupId types.String `tfsdk:"group_id"` + RegisteredAt types.String `tfsdk:"registered_at"` + ConfigJson types.String `tfsdk:"config_json"` + AuthJson types.String `tfsdk:"auth_json"` + DockerComposeYaml types.String `tfsdk:"docker_compose_yaml"` + AuthenticationCounter types.Int64 `tfsdk:"authentication_counter"` +} + +var _ hybridDeploymentAgentModel = &HybridDeploymentAgentResourceModel{} + +func (d *HybridDeploymentAgentResourceModel) SetId(value string) { + d.Id = types.StringValue(value) +} +func (d *HybridDeploymentAgentResourceModel) SetGroupId(value string) { + d.GroupId = types.StringValue(value) +} +func (d *HybridDeploymentAgentResourceModel) SetDisplayName(value string) { + d.DisplayName = types.StringValue(value) +} +func (d *HybridDeploymentAgentResourceModel) SetRegisteredAt(value string) { + d.RegisteredAt = types.StringValue(value) +} +func (d *HybridDeploymentAgentResourceModel) SetConfigJson(value string) { + d.ConfigJson = types.StringValue(value) +} +func (d *HybridDeploymentAgentResourceModel) SetAuthJson(value string) { + d.AuthJson = types.StringValue(value) +} +func (d *HybridDeploymentAgentResourceModel) SetDockerComposeYaml(value string) { + d.DockerComposeYaml = types.StringValue(value) +} +func (d *HybridDeploymentAgentResourceModel) ReadFromCreateResponse(resp hybriddeploymentagent.HybridDeploymentAgentCreateResponse) { + var model hybridDeploymentAgentModel = d + readHybridDeploymentAgentFromCreateResponse(model, resp) + d.AuthenticationCounter = types.Int64Value(d.AuthenticationCounter.ValueInt64() + 1) +} + +func (d *HybridDeploymentAgentResourceModel) ReadFromResponse(resp hybriddeploymentagent.HybridDeploymentAgentDetailsResponse) { + var model hybridDeploymentAgentModel = d + readHybridDeploymentAgentFromResponse(model, resp) +} \ No newline at end of file diff --git a/fivetran/framework/core/model/hybrid_deployment_agents.go b/fivetran/framework/core/model/hybrid_deployment_agents.go new file mode 100644 index 00000000..2cffbdb6 --- /dev/null +++ b/fivetran/framework/core/model/hybrid_deployment_agents.go @@ -0,0 +1,41 @@ +package model + +import ( + "context" + + "github.com/fivetran/go-fivetran/hybrid_deployment_agent" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/attr" +) + +type HybridDeploymentAgents struct { + Items types.Set `tfsdk:"items"` +} + +func (d *HybridDeploymentAgents) ReadFromResponse(ctx context.Context, resp hybriddeploymentagent.HybridDeploymentAgentListResponse) { + elementType := map[string]attr.Type{ + "id": types.StringType, + "display_name": types.StringType, + "group_id": types.StringType, + "registered_at": types.StringType, + } + + if resp.Data.Items == nil { + d.Items = types.SetNull(types.ObjectType{AttrTypes: elementType}) + } + + items := []attr.Value{} + + for _, v := range resp.Data.Items { + item := map[string]attr.Value{} + item["id"] = types.StringValue(v.Id) + item["display_name"] = types.StringValue(v.DisplayName) + item["group_id"] = types.StringValue(v.GroupId) + item["registered_at"] = types.StringValue(v.RegisteredAt) + + objectValue, _ := types.ObjectValue(elementType, item) + items = append(items, objectValue) + } + + d.Items, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) +} \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agent_datasource_model.go b/fivetran/framework/core/model/local_processing_agent_datasource_model.go deleted file mode 100644 index 83273d94..00000000 --- a/fivetran/framework/core/model/local_processing_agent_datasource_model.go +++ /dev/null @@ -1,65 +0,0 @@ -package model - -import ( - "github.com/fivetran/go-fivetran/local_processing_agent" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/attr" -) - -type LocalProcessingAgentDatasourceModel struct { - Id types.String `tfsdk:"id"` - DisplayName types.String `tfsdk:"display_name"` - GroupId types.String `tfsdk:"group_id"` - RegisteredAt types.String `tfsdk:"registered_at"` - Usage types.Set `tfsdk:"usage"` -} - -var ( - elementType = map[string]attr.Type{ - "connection_id": types.StringType, - "schema": types.StringType, - "service": types.StringType, - } -) - -var _ localProcessingAgentModel = &LocalProcessingAgentDatasourceModel{} - -func (d *LocalProcessingAgentDatasourceModel) SetId(value string) { - d.Id = types.StringValue(value) -} -func (d *LocalProcessingAgentDatasourceModel) SetGroupId(value string) { - d.GroupId = types.StringValue(value) -} -func (d *LocalProcessingAgentDatasourceModel) SetDisplayName(value string) { - d.DisplayName = types.StringValue(value) -} -func (d *LocalProcessingAgentDatasourceModel) SetRegisteredAt(value string) { - d.RegisteredAt = types.StringValue(value) -} -func (d *LocalProcessingAgentDatasourceModel) SetUsage(value []localprocessingagent.LocalProcessingAgentUsageDetails) { - if value == nil { - d.Usage = types.SetNull(types.ObjectType{AttrTypes: elementType}) - } - - items := []attr.Value{} - for _, v := range value { - item := map[string]attr.Value{} - item["connection_id"] = types.StringValue(v.ConnectionId) - item["schema"] = types.StringValue(v.Schema) - item["service"] = types.StringValue(v.Service) - - objectValue, _ := types.ObjectValue(elementType, item) - items = append(items, objectValue) - } - - d.Usage, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) -} - -func (d *LocalProcessingAgentDatasourceModel) SetConfigJson(value string) {} -func (d *LocalProcessingAgentDatasourceModel) SetAuthJson(value string) {} -func (d *LocalProcessingAgentDatasourceModel) SetDockerComposeYaml(value string) {} - -func (d *LocalProcessingAgentDatasourceModel) ReadFromResponse(resp localprocessingagent.LocalProcessingAgentDetailsResponse) { - var model localProcessingAgentModel = d - readLocalProcessingAgentFromResponse(model, resp) -} \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agent_resource_model.go b/fivetran/framework/core/model/local_processing_agent_resource_model.go deleted file mode 100644 index 550e0999..00000000 --- a/fivetran/framework/core/model/local_processing_agent_resource_model.go +++ /dev/null @@ -1,71 +0,0 @@ -package model - -import ( - "github.com/fivetran/go-fivetran/local_processing_agent" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/attr" -) - -type LocalProcessingAgentResourceModel struct { - Id types.String `tfsdk:"id"` - DisplayName types.String `tfsdk:"display_name"` - GroupId types.String `tfsdk:"group_id"` - RegisteredAt types.String `tfsdk:"registered_at"` - ConfigJson types.String `tfsdk:"config_json"` - AuthJson types.String `tfsdk:"auth_json"` - DockerComposeYaml types.String `tfsdk:"docker_compose_yaml"` - AuthenticationCounter types.Int64 `tfsdk:"authentication_counter"` - Usage types.Set `tfsdk:"usage"` -} - -var _ localProcessingAgentModel = &LocalProcessingAgentResourceModel{} - -func (d *LocalProcessingAgentResourceModel) SetId(value string) { - d.Id = types.StringValue(value) -} -func (d *LocalProcessingAgentResourceModel) SetGroupId(value string) { - d.GroupId = types.StringValue(value) -} -func (d *LocalProcessingAgentResourceModel) SetDisplayName(value string) { - d.DisplayName = types.StringValue(value) -} -func (d *LocalProcessingAgentResourceModel) SetRegisteredAt(value string) { - d.RegisteredAt = types.StringValue(value) -} -func (d *LocalProcessingAgentResourceModel) SetConfigJson(value string) { - d.ConfigJson = types.StringValue(value) -} -func (d *LocalProcessingAgentResourceModel) SetAuthJson(value string) { - d.AuthJson = types.StringValue(value) -} -func (d *LocalProcessingAgentResourceModel) SetDockerComposeYaml(value string) { - d.DockerComposeYaml = types.StringValue(value) -} -func (d *LocalProcessingAgentResourceModel) SetUsage(value []localprocessingagent.LocalProcessingAgentUsageDetails) { - if value == nil { - d.Usage = types.SetNull(types.ObjectType{AttrTypes: elementType}) - } - - items := []attr.Value{} - for _, v := range value { - item := map[string]attr.Value{} - item["connection_id"] = types.StringValue(v.ConnectionId) - item["schema"] = types.StringValue(v.Schema) - item["service"] = types.StringValue(v.Service) - - objectValue, _ := types.ObjectValue(elementType, item) - items = append(items, objectValue) - } - - d.Usage, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) -} -func (d *LocalProcessingAgentResourceModel) ReadFromCreateResponse(resp localprocessingagent.LocalProcessingAgentCreateResponse) { - var model localProcessingAgentModel = d - readLocalProcessingAgentFromCreateResponse(model, resp) - d.AuthenticationCounter = types.Int64Value(d.AuthenticationCounter.ValueInt64() + 1) -} - -func (d *LocalProcessingAgentResourceModel) ReadFromResponse(resp localprocessingagent.LocalProcessingAgentDetailsResponse) { - var model localProcessingAgentModel = d - readLocalProcessingAgentFromResponse(model, resp) -} \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agents.go b/fivetran/framework/core/model/local_processing_agents.go deleted file mode 100644 index 20b7a3d7..00000000 --- a/fivetran/framework/core/model/local_processing_agents.go +++ /dev/null @@ -1,65 +0,0 @@ -package model - -import ( - "context" - - "github.com/fivetran/go-fivetran/local_processing_agent" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/attr" -) - -type LocalProcessingAgents struct { - Items types.Set `tfsdk:"items"` -} - -func (d *LocalProcessingAgents) ReadFromResponse(ctx context.Context, resp localprocessingagent.LocalProcessingAgentListResponse) { - subSetElementType := map[string]attr.Type{ - "connection_id": types.StringType, - "schema": types.StringType, - "service": types.StringType, - } - - subSetAttrType := types.ObjectType{ - AttrTypes: subSetElementType, - } - - elementType := map[string]attr.Type{ - "id": types.StringType, - "display_name": types.StringType, - "group_id": types.StringType, - "registered_at": types.StringType, - "usage": types.SetType{ElemType: subSetAttrType}, - } - - if resp.Data.Items == nil { - d.Items = types.SetNull(types.ObjectType{AttrTypes: elementType}) - } - - items := []attr.Value{} - - for _, v := range resp.Data.Items { - item := map[string]attr.Value{} - item["id"] = types.StringValue(v.Id) - item["display_name"] = types.StringValue(v.DisplayName) - item["group_id"] = types.StringValue(v.GroupId) - item["registered_at"] = types.StringValue(v.RegisteredAt) - - subItems := []attr.Value{} - for _, sub := range v.Usage { - subItem := map[string]attr.Value{} - subItem["connection_id"] = types.StringValue(sub.ConnectionId) - subItem["schema"] = types.StringValue(sub.Schema) - subItem["service"] = types.StringValue(sub.Service) - - subObjectValue, _ := types.ObjectValue(subSetElementType, subItem) - subItems = append(subItems, subObjectValue) - } - - item["usage"], _ = types.SetValue(subSetAttrType, subItems) - - objectValue, _ := types.ObjectValue(elementType, item) - items = append(items, objectValue) - } - - d.Items, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) -} \ No newline at end of file diff --git a/fivetran/framework/core/model/private_link.go b/fivetran/framework/core/model/private_link.go new file mode 100644 index 00000000..2bfa2310 --- /dev/null +++ b/fivetran/framework/core/model/private_link.go @@ -0,0 +1,226 @@ +package model + +import ( + "context" + + "github.com/fivetran/go-fivetran/private_link" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-framework/attr" +) + +type PrivateLink struct { + Id types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Region types.String `tfsdk:"region"` + Service types.String `tfsdk:"service"` + CloudProvider types.String `tfsdk:"cloud_provider"` + State types.String `tfsdk:"state"` + StateSummary types.String `tfsdk:"state_summary"` + CreatedAt types.String `tfsdk:"created_at"` + CreatedBy types.String `tfsdk:"created_by"` + + Config types.Object `tfsdk:"config"` + CustomConfig types.Object `tfsdk:"custom_config"` +} + +var PrivateLinkConfigType = map[string]attr.Type{ + "connection_service_name": types.StringType, + "account_url": types.StringType, + "vpce_id": types.StringType, + "aws_account_id": types.StringType, + "cluster_identifier": types.StringType, + "connection_service_id": types.StringType, + "workspace_url": types.StringType, + "pls_id": types.StringType, + "sub_resource_name": types.StringType, + "private_dns_regions": types.StringType, + "private_connection_service_id": types.StringType, +} + +func (d *PrivateLink) ReadFromResponse(ctx context.Context, resp privatelink.PrivateLinkResponse) { + d.Id = types.StringValue(resp.Data.Id) + d.Name = types.StringValue(resp.Data.Name) + d.Service = types.StringValue(resp.Data.Service) + d.Region = types.StringValue(resp.Data.Region) + d.CloudProvider = types.StringValue(resp.Data.CloudProvider) + d.State = types.StringValue(resp.Data.State) + d.StateSummary = types.StringValue(resp.Data.StateSummary) + d.CreatedAt = types.StringValue(resp.Data.CreatedAt) + d.CreatedBy = types.StringValue(resp.Data.CreatedBy) + + config := map[string]attr.Value{} + + if resp.Data.Config.ConnectionServiceName != "" { + config["connection_service_name"] = types.StringValue(resp.Data.Config.ConnectionServiceName) + } else { + config["connection_service_name"] = types.StringNull() + } + + if resp.Data.Config.AccountUrl != "" { + config["account_url"] = types.StringValue(resp.Data.Config.AccountUrl) + } else { + config["account_url"] = types.StringNull() + } + + if resp.Data.Config.VpceId != "" { + config["vpce_id"] = types.StringValue(resp.Data.Config.VpceId) + } else { + config["vpce_id"] = types.StringNull() + } + + if resp.Data.Config.AwsAccountId != "" { + config["aws_account_id"] = types.StringValue(resp.Data.Config.AwsAccountId) + } else { + config["aws_account_id"] = types.StringNull() + } + + if resp.Data.Config.ClusterIdentifier != "" { + config["cluster_identifier"] = types.StringValue(resp.Data.Config.ClusterIdentifier) + } else { + config["cluster_identifier"] = types.StringNull() + } + + if resp.Data.Config.ConnectionServiceId != "" { + config["connection_service_id"] = types.StringValue(resp.Data.Config.ConnectionServiceId) + } else { + config["connection_service_id"] = types.StringNull() + } + + if resp.Data.Config.WorkspaceUrl != "" { + config["workspace_url"] = types.StringValue(resp.Data.Config.WorkspaceUrl) + } else { + config["workspace_url"] = types.StringNull() + } + + if resp.Data.Config.PlsId != "" { + config["pls_id"] = types.StringValue(resp.Data.Config.PlsId) + } else { + config["pls_id"] = types.StringNull() + } + + if resp.Data.Config.SubResourceName != "" { + config["sub_resource_name"] = types.StringValue(resp.Data.Config.SubResourceName) + } else { + config["sub_resource_name"] = types.StringNull() + } + + if resp.Data.Config.PrivateDnsRegions != "" { + config["private_dns_regions"] = types.StringValue(resp.Data.Config.PrivateDnsRegions) + } else { + config["private_dns_regions"] = types.StringNull() + } + + if resp.Data.Config.PrivateConnectionServiceId != "" { + config["private_connection_service_id"] = types.StringValue(resp.Data.Config.PrivateConnectionServiceId) + } else { + config["private_connection_service_id"] = types.StringNull() + } + + d.Config, _ = types.ObjectValue(PrivateLinkConfigType, config) +} + +func (d *PrivateLink) ReadFromCustomResponse(ctx context.Context, resp privatelink.PrivateLinkCustomResponse) { + d.Id = types.StringValue(resp.Data.Id) + d.Name = types.StringValue(resp.Data.Name) + d.Service = types.StringValue(resp.Data.Service) + d.Region = types.StringValue(resp.Data.Region) + d.CloudProvider = types.StringValue(resp.Data.CloudProvider) + d.State = types.StringValue(resp.Data.State) + d.StateSummary = types.StringValue(resp.Data.StateSummary) + d.CreatedAt = types.StringValue(resp.Data.CreatedAt) + d.CreatedBy = types.StringValue(resp.Data.CreatedBy) + + config := map[string]attr.Value{} + + if resp.Data.Config["connection_service_name"] != nil && resp.Data.Config["connection_service_name"] != "" { + config["connection_service_name"] = types.StringValue(resp.Data.Config["connection_service_name"].(string)) + } else { + config["connection_service_name"] = types.StringNull() + } + + if resp.Data.Config["account_url"] != nil && resp.Data.Config["account_url"] != "" { + config["account_url"] = types.StringValue(resp.Data.Config["account_url"].(string)) + } else { + config["account_url"] = types.StringNull() + } + + if resp.Data.Config["vpce_id"] != nil && resp.Data.Config["vpce_id"] != "" { + config["vpce_id"] = types.StringValue(resp.Data.Config["vpce_id"].(string)) + } else { + config["vpce_id"] = types.StringNull() + } + + if resp.Data.Config["aws_account_id"] != nil && resp.Data.Config["aws_account_id"] != "" { + config["aws_account_id"] = types.StringValue(resp.Data.Config["aws_account_id"].(string)) + } else { + config["aws_account_id"] = types.StringNull() + } + + if resp.Data.Config["cluster_identifier"] != nil && resp.Data.Config["cluster_identifier"] != "" { + config["cluster_identifier"] = types.StringValue(resp.Data.Config["cluster_identifier"].(string)) + } else { + config["cluster_identifier"] = types.StringNull() + } + + if resp.Data.Config["connection_service_id"] != nil && resp.Data.Config["connection_service_id"] != "" { + config["connection_service_id"] = types.StringValue(resp.Data.Config["connection_service_id"].(string)) + } else { + config["connection_service_id"] = types.StringNull() + } + + if resp.Data.Config["workspace_url"] != nil && resp.Data.Config["workspace_url"] != "" { + config["workspace_url"] = types.StringValue(resp.Data.Config["workspace_url"].(string)) + } else { + config["workspace_url"] = types.StringNull() + } + + if resp.Data.Config["pls_id"] != nil && resp.Data.Config["pls_id"] != "" { + config["pls_id"] = types.StringValue(resp.Data.Config["pls_id"].(string)) + } else { + config["pls_id"] = types.StringNull() + } + + if resp.Data.Config["sub_resource_name"] != nil && resp.Data.Config["sub_resource_name"] != "" { + config["sub_resource_name"] = types.StringValue(resp.Data.Config["sub_resource_name"].(string)) + } else { + config["sub_resource_name"] = types.StringNull() + } + + if resp.Data.Config["private_dns_regions"] != nil && resp.Data.Config["private_dns_regions"] != "" { + config["private_dns_regions"] = types.StringValue(resp.Data.Config["private_dns_regions"].(string)) + } else { + config["private_dns_regions"] = types.StringNull() + } + + if resp.Data.Config["private_connection_service_id"] != nil { + config["private_connection_service_id"] = types.BoolValue(resp.Data.Config["private_connection_service_id"].(bool)) + } else { + config["private_connection_service_id"] = types.BoolValue(false) + } + + d.Config, _ = types.ObjectValue(PrivateLinkConfigType, config) +} + +func (d *PrivateLink) GetConfig() map[string]interface{} { + attr := d.CustomConfig.Attributes() + + config := make(map[string]interface{}) + for k, v := range attr{ + if !v.IsUnknown() && !v.IsNull() { + if t, ok := v.(basetypes.Int64Value); ok { + config[k] = t.ValueInt64() + } + + if t, ok := v.(basetypes.BoolValue); ok { + config[k] = t.ValueBool() + } + + if t, ok := v.(basetypes.StringValue); ok { + config[k] = t.ValueString() + } + } + } + + return config +} \ No newline at end of file diff --git a/fivetran/framework/core/model/private_links.go b/fivetran/framework/core/model/private_links.go new file mode 100644 index 00000000..21ae79dd --- /dev/null +++ b/fivetran/framework/core/model/private_links.go @@ -0,0 +1,51 @@ +package model + +import ( + "context" + + "github.com/fivetran/go-fivetran/private_link" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/attr" +) + +type PrivateLinks struct { + Items types.Set `tfsdk:"items"` +} + +func (d *PrivateLinks) ReadFromResponse(ctx context.Context, resp privatelink.PrivateLinkListResponse) { + elementType := map[string]attr.Type{ + "id": types.StringType, + "region": types.StringType, + "name": types.StringType, + "service": types.StringType, + "cloud_provider": types.StringType, + "state": types.StringType, + "state_summary": types.StringType, + "created_by": types.StringType, + "created_at": types.StringType, + } + + if resp.Data.Items == nil { + d.Items = types.SetNull(types.ObjectType{AttrTypes: elementType}) + } + + items := []attr.Value{} + + for _, v := range resp.Data.Items { + item := map[string]attr.Value{} + item["id"] = types.StringValue(v.Id) + item["region"] = types.StringValue(v.Region) + item["name"] = types.StringValue(v.Name) + item["service"] = types.StringValue(v.Service) + item["cloud_provider"] = types.StringValue(v.CloudProvider) + item["state"] = types.StringValue(v.State) + item["state_summary"] = types.StringValue(v.StateSummary) + item["created_at"] = types.StringValue(v.CreatedAt) + item["created_by"] = types.StringValue(v.CreatedBy) + + objectValue, _ := types.ObjectValue(elementType, item) + items = append(items, objectValue) + } + + d.Items, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) +} \ No newline at end of file diff --git a/fivetran/framework/core/schema/connector.go b/fivetran/framework/core/schema/connector.go index 5cb04896..6b949d63 100644 --- a/fivetran/framework/core/schema/connector.go +++ b/fivetran/framework/core/schema/connector.go @@ -44,7 +44,6 @@ func ConnectorAttributesSchema() core.Schema { ValueType: core.String, Description: "The connector type id within the Fivetran system.", }, - "run_setup_tests": { ValueType: core.Boolean, Description: "Specifies whether the setup tests should be run automatically. The default value is FALSE.", @@ -109,9 +108,13 @@ func ConnectorAttributesSchema() core.Schema { ValueType: core.StringEnum, Description: "Possible values: Directly, SshTunnel, ProxyAgent.", }, - "local_processing_agent_id": { + "hybrid_deployment_agent_id": { + ValueType: core.String, + Description: "The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", + }, + "private_link_id": { ValueType: core.String, - Description: "The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", + Description: "The private link ID.", }, }, } diff --git a/fivetran/framework/core/schema/destination.go b/fivetran/framework/core/schema/destination.go index f6dad707..385b8282 100644 --- a/fivetran/framework/core/schema/destination.go +++ b/fivetran/framework/core/schema/destination.go @@ -60,12 +60,16 @@ func DestinationAttributesSchema() core.Schema { Description: "Destination setup status.", }, "daylight_saving_time_enabled": { - ValueType: core.Boolean, - Description: "Shift my UTC offset with daylight savings time (US Only)", + ValueType: core.Boolean, + Description: "Shift my UTC offset with daylight savings time (US Only)", + }, + "private_link_id": { + ValueType: core.String, + Description: "The private link ID.", }, - "local_processing_agent_id": { + "hybrid_deployment_agent_id": { ValueType: core.String, - Description: "The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", + Description: "The lhybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", }, "networking_method": { ValueType: core.StringEnum, diff --git a/fivetran/framework/core/schema/local_processing_agent.go b/fivetran/framework/core/schema/hybrid_deployment_agent.go similarity index 50% rename from fivetran/framework/core/schema/local_processing_agent.go rename to fivetran/framework/core/schema/hybrid_deployment_agent.go index 69eb1091..df119404 100644 --- a/fivetran/framework/core/schema/local_processing_agent.go +++ b/fivetran/framework/core/schema/hybrid_deployment_agent.go @@ -6,13 +6,13 @@ import ( resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema" ) -func localDataProcessingAgentAttribute() core.Schema { +func hybridDeploymentAgentAttribute() core.Schema { result := core.Schema{ Fields: map[string]core.SchemaField{ "id": { IsId: true, ValueType: core.String, - Description: "The unique identifier for the local processing agent within your account.", + Description: "The unique identifier for the hybrid deployment agent within your account.", }, "group_id": { Required: true, @@ -24,12 +24,18 @@ func localDataProcessingAgentAttribute() core.Schema { Required: true, ForceNew: true, ValueType: core.String, - Description: "The unique name for the local processing agent.", + Description: "The unique name for the hybrid deployment agent.", + }, + "auth_type": { + Required: true, + ForceNew: true, + ValueType: core.String, + Description: "Type of authentification. Possible values `AUTO`,`MANUAL`", }, "registered_at": { Readonly: true, ValueType: core.String, - Description: "The timestamp of the time the local processing agent was created in your account.", + Description: "The timestamp of the time the hybrid deployment agent was created in your account.", }, "authentication_counter": { ResourceOnly: true, @@ -54,72 +60,32 @@ func localDataProcessingAgentAttribute() core.Schema { ValueType: core.String, Description: "Base64-encoded content of the compose file for the chosen containerization type.", }, - }, - } - return result -} - -func localDataProcessingAgentUsageAttribute() core.Schema { - return core.Schema{ - Fields: map[string]core.SchemaField{ - "connection_id": { - Readonly: true, - ValueType: core.String, - Description: "The unique identifier of the connection associated with the agent.", - }, - "schema": { - Required: true, - ValueType: core.String, - Description: "The connection schema name.", - }, - "service": { - Required: true, - ValueType: core.String, - Description: "The connection type.", + "token": { + ResourceOnly: true, + Readonly: true, + ValueType: core.String, + Description: "Base64 encoded content of token.", }, }, } + return result } -func localDataProcessingAgentDatasourceSchema() map[string]datasourceSchema.Attribute { - schema := localDataProcessingAgentAttribute().GetDatasourceSchema() - - schema["usage"] = datasourceSchema.SetNestedAttribute{ - Computed: true, - NestedObject: datasourceSchema.NestedAttributeObject{ - Attributes: localDataProcessingAgentUsageAttribute().GetDatasourceSchema(), - }, - } - return schema -} - -func localDataProcessingAgentResourceSchema() map[string]resourceSchema.Attribute { - schema := localDataProcessingAgentAttribute().GetResourceSchema() - - schema["usage"] = resourceSchema.SetNestedAttribute{ - Computed: true, - NestedObject: resourceSchema.NestedAttributeObject{ - Attributes: localDataProcessingAgentUsageAttribute().GetResourceSchema(), - }, - } - return schema -} - -func LocalProcessingAgentResource() resourceSchema.Schema { - return resourceSchema.Schema{Attributes: localDataProcessingAgentResourceSchema(),} +func HybridDeploymentAgentResource() resourceSchema.Schema { + return resourceSchema.Schema{Attributes: hybridDeploymentAgentAttribute().GetResourceSchema(),} } -func LocalProcessingAgentDatasource() datasourceSchema.Schema { - return datasourceSchema.Schema{Attributes: localDataProcessingAgentDatasourceSchema(),} +func HybridDeploymentAgentDatasource() datasourceSchema.Schema { + return datasourceSchema.Schema{Attributes: hybridDeploymentAgentAttribute().GetDatasourceSchema(),} } -func LocalProcessingAgentsDatasource() datasourceSchema.Schema { +func HybridDeploymentAgentsDatasource() datasourceSchema.Schema { return datasourceSchema.Schema{ Attributes: map[string]datasourceSchema.Attribute{ "items": datasourceSchema.SetNestedAttribute{ Computed: true, NestedObject: datasourceSchema.NestedAttributeObject{ - Attributes: localDataProcessingAgentDatasourceSchema(), + Attributes: hybridDeploymentAgentAttribute().GetDatasourceSchema(), }, }, }, diff --git a/fivetran/framework/core/schema/private_link.go b/fivetran/framework/core/schema/private_link.go new file mode 100644 index 00000000..6676ba19 --- /dev/null +++ b/fivetran/framework/core/schema/private_link.go @@ -0,0 +1,246 @@ +package schema + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema" + datasourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func PrivateLinkResource() resourceSchema.Schema { + return resourceSchema.Schema { + Attributes: map[string]resourceSchema.Attribute{ + "id": resourceSchema.StringAttribute{ + Computed: true, + Description: "The unique identifier for the private link within the Fivetran system.", + }, + "region": resourceSchema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, + Description: "Data processing location. This is where Fivetran will operate and run computation on data.", + }, + "name": resourceSchema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, + Description: "The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters.", + }, + "service": resourceSchema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, + Description: "Service type.", + }, + "cloud_provider": resourceSchema.StringAttribute{ + Computed: true, + Description: "The cloud provider name.", + }, + "state": resourceSchema.StringAttribute{ + Computed: true, + Description: "The state of the private link.", + }, + "state_summary": resourceSchema.StringAttribute{ + Computed: true, + Description: "The state of the private link.", + }, + "created_at": resourceSchema.StringAttribute{ + Computed: true, + Description: "The date and time the membership was created.", + }, + "created_by": resourceSchema.StringAttribute{ + Computed: true, + Description: "The unique identifier for the User within the Fivetran system.", + }, + }, + Blocks: map[string]resourceSchema.Block{ + "config": resourceSchema.SingleNestedBlock{ + Attributes: map[string]resourceSchema.Attribute{ + "connection_service_name": resourceSchema.StringAttribute{ + Optional: true, + Description: "The name of your connection service.", + }, + "account_url": resourceSchema.StringAttribute{ + Optional: true, + Description: "The URL of your account.", + }, + "vpce_id": resourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your Virtual Private Cloud Endpoint.", + }, + "aws_account_id": resourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your AWS account.", + }, + "cluster_identifier": resourceSchema.StringAttribute{ + Optional: true, + Description: "The cluster identifier.", + }, + "connection_service_id": resourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your connection service.", + }, + "workspace_url": resourceSchema.StringAttribute{ + Optional: true, + Description: "The URL of your workspace.", + }, + "pls_id": resourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your Azure Private Link service.", + }, + "sub_resource_name": resourceSchema.StringAttribute{ + Optional: true, + Description: "The name of subresource.", + }, + "private_dns_regions": resourceSchema.StringAttribute{ + Optional: true, + Description: "Private DNS Regions.", + }, + "private_connection_service_id": resourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your connection service.", + }, + }, + }, + }, + } +} + +func PrivateLinkDatasource() datasourceSchema.Schema { + return datasourceSchema.Schema { + Attributes: map[string]datasourceSchema.Attribute{ + "id": datasourceSchema.StringAttribute{ + Required: true, + Description: "The unique identifier for the private link within the Fivetran system.", + }, + "region": datasourceSchema.StringAttribute{ + Computed: true, + Description: "Data processing location. This is where Fivetran will operate and run computation on data.", + }, + "name": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters.", + }, + "service": datasourceSchema.StringAttribute{ + Computed: true, + Description: "Service type.", + }, + "cloud_provider": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The cloud provider name.", + }, + "state": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The state of the private link.", + }, + "state_summary": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The state of the private link.", + }, + "created_at": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The date and time the membership was created.", + }, + "created_by": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The unique identifier for the User within the Fivetran system.", + }, + }, + Blocks: map[string]datasourceSchema.Block{ + "config": datasourceSchema.SingleNestedBlock{ + Attributes: map[string]datasourceSchema.Attribute{ + "connection_service_name": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The name of your connection service.", + }, + "account_url": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The URL of your account.", + }, + "vpce_id": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your Virtual Private Cloud Endpoint.", + }, + "aws_account_id": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your AWS account.", + }, + "cluster_identifier": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The cluster identifier.", + }, + "connection_service_id": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your connection service.", + }, + "workspace_url": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The URL of your workspace.", + }, + "pls_id": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your Azure Private Link service.", + }, + "sub_resource_name": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The name of subresource.", + }, + "private_dns_regions": datasourceSchema.StringAttribute{ + Optional: true, + Description: "Private DNS Regions.", + }, + "private_connection_service_id": datasourceSchema.StringAttribute{ + Optional: true, + Description: "The ID of your connection service.", + }, + }, + }, + }, + } +} + +func PrivateLinksDatasource() datasourceSchema.Schema { + return datasourceSchema.Schema { + Blocks: map[string]datasourceSchema.Block{ + "items": datasourceSchema.SetNestedBlock{ + NestedObject: datasourceSchema.NestedBlockObject{ + Attributes: map[string]datasourceSchema.Attribute{ + "id": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The unique identifier for the private link within the Fivetran system.", + }, + "region": datasourceSchema.StringAttribute{ + Computed: true, + Description: "Data processing location. This is where Fivetran will operate and run computation on data.", + }, + "name": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters.", + }, + "service": datasourceSchema.StringAttribute{ + Computed: true, + Description: "Service type.", + }, + "cloud_provider": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The cloud provider name.", + }, + "state": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The state of the private link.", + }, + "state_summary": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The state of the private link.", + }, + "created_at": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The date and time the membership was created.", + }, + "created_by": datasourceSchema.StringAttribute{ + Computed: true, + Description: "The unique identifier for the User within the Fivetran system.", + }, + }, + }, + }, + }, + } +} diff --git a/fivetran/framework/datasources/local_processing_agent.go b/fivetran/framework/datasources/hybrid_deployment_agent.go similarity index 54% rename from fivetran/framework/datasources/local_processing_agent.go rename to fivetran/framework/datasources/hybrid_deployment_agent.go index 28840514..afe282b9 100644 --- a/fivetran/framework/datasources/local_processing_agent.go +++ b/fivetran/framework/datasources/hybrid_deployment_agent.go @@ -11,26 +11,26 @@ import ( fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" ) -func LocalProcessingAgent() datasource.DataSource { - return &localProcessingAgent{} +func HybridDeploymentAgent() datasource.DataSource { + return &hybridDeploymentAgent{} } // Ensure the implementation satisfies the desired interfaces. -var _ datasource.DataSourceWithConfigure = &localProcessingAgent{} +var _ datasource.DataSourceWithConfigure = &hybridDeploymentAgent{} -type localProcessingAgent struct { +type hybridDeploymentAgent struct { core.ProviderDatasource } -func (d *localProcessingAgent) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = "fivetran_local_processing_agent" +func (d *hybridDeploymentAgent) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = "fivetran_hybrid_deployment_agent" } -func (d *localProcessingAgent) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = fivetranSchema.LocalProcessingAgentDatasource() +func (d *hybridDeploymentAgent) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = fivetranSchema.HybridDeploymentAgentDatasource() } -func (d *localProcessingAgent) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *hybridDeploymentAgent) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { if d.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -40,11 +40,11 @@ func (d *localProcessingAgent) Read(ctx context.Context, req datasource.ReadRequ return } - var data model.LocalProcessingAgentDatasourceModel + var data model.HybridDeploymentAgentDatasourceModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - detailsResponse, err := d.GetClient().NewLocalProcessingAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) + detailsResponse, err := d.GetClient().NewHybridDeploymentAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( diff --git a/fivetran/framework/datasources/hybrid_deployment_agent_test.go b/fivetran/framework/datasources/hybrid_deployment_agent_test.go new file mode 100644 index 00000000..1ce6d5f6 --- /dev/null +++ b/fivetran/framework/datasources/hybrid_deployment_agent_test.go @@ -0,0 +1,87 @@ +package datasources_test + +import ( + "net/http" + "testing" + + "github.com/fivetran/go-fivetran/tests/mock" + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var ( + hdaDataSourceMockGetHandler *mock.Handler + hdaDataSourceMockData map[string]interface{} +) + +const ( + hdaMappingResponse = ` + { + "id": "lpa_id", + "display_name": "display_name", + "group_id": "group_id", + "registered_at": "registered_at", + "usage": [ + { + "connection_id": "connection_id1", + "schema": "schema1", + "service": "service1" + }, + { + "connection_id": "connection_id2", + "schema": "schema2", + "service": "service2" + } + ] + } + ` +) + +func setupMockClientHybridDeploymentAgentDataSourceConfigMapping(t *testing.T) { + tfmock.MockClient().Reset() + + hdaDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + hdaDataSourceMockData = tfmock.CreateMapFromJsonString(t, hdaMappingResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", hdaDataSourceMockData), nil + }, + ) +} + +func TestDataSourceHybridDeploymentAgentMappingMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + data "fivetran_hybrid_deployment_agent" "test_lpa" { + provider = fivetran-provider + id = "lpa_id" + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, hdaDataSourceMockGetHandler.Interactions, 1) + tfmock.AssertNotEmpty(t, hdaDataSourceMockData) + return nil + }, + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agent.test_lpa", "display_name", "display_name"), + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agent.test_lpa", "group_id", "group_id"), + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agent.test_lpa", "registered_at", "registered_at"), + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientHybridDeploymentAgentDataSourceConfigMapping(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + return nil + }, + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/framework/datasources/hybrid_deployment_agents.go b/fivetran/framework/datasources/hybrid_deployment_agents.go new file mode 100644 index 00000000..5430c1d0 --- /dev/null +++ b/fivetran/framework/datasources/hybrid_deployment_agents.go @@ -0,0 +1,84 @@ +package datasources + +import ( + "context" + "fmt" + + "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core" + "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/model" + "github.com/hashicorp/terraform-plugin-framework/datasource" + sdk "github.com/fivetran/go-fivetran/hybrid_deployment_agent" + + fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" +) + +func HybridDeploymentAgents() datasource.DataSource { + return &hybridDeploymentAgents{} +} + +// Ensure the implementation satisfies the desired interfaces. +var _ datasource.DataSourceWithConfigure = &hybridDeploymentAgents{} + +type hybridDeploymentAgents struct { + core.ProviderDatasource +} + +func (d *hybridDeploymentAgents) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = "fivetran_hybrid_deployment_agents" +} + +func (d *hybridDeploymentAgents) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = fivetranSchema.HybridDeploymentAgentsDatasource() +} + +func (d *hybridDeploymentAgents) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + if d.GetClient() == nil { + resp.Diagnostics.AddError( + "Unconfigured Fivetran Client", + "Please report this issue to the provider developers.", + ) + + return + } + + var data model.HybridDeploymentAgents + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + var respNextCursor string + var listResponse sdk.HybridDeploymentAgentListResponse + limit := 1000 + + for { + var err error + var tmpResp sdk.HybridDeploymentAgentListResponse + svc := d.GetClient().NewHybridDeploymentAgentList() + + if respNextCursor == "" { + tmpResp, err = svc.Limit(limit).Do(ctx) + } + + if respNextCursor != "" { + tmpResp, err = svc.Limit(limit).Cursor(respNextCursor).Do(ctx) + } + + if err != nil { + resp.Diagnostics.AddError( + "Read error.", + fmt.Sprintf("%v; code: %v", err, tmpResp.Code), + ) + listResponse = sdk.HybridDeploymentAgentListResponse{} + } + + listResponse.Data.Items = append(listResponse.Data.Items, tmpResp.Data.Items...) + + if tmpResp.Data.NextCursor == "" { + break + } + + respNextCursor = tmpResp.Data.NextCursor + } + + data.ReadFromResponse(ctx, listResponse) + + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/fivetran/framework/datasources/hybrid_deployment_agents_test.go b/fivetran/framework/datasources/hybrid_deployment_agents_test.go new file mode 100644 index 00000000..6ee7b68c --- /dev/null +++ b/fivetran/framework/datasources/hybrid_deployment_agents_test.go @@ -0,0 +1,111 @@ +package datasources_test + +import ( + "net/http" + "testing" + + "github.com/fivetran/go-fivetran/tests/mock" + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var ( + hybridDeploymentAgentsDataSourceMockGetHandler *mock.Handler + hybridDeploymentAgentsDataSourceMockData map[string]interface{} +) + +const ( + hybridDeploymentAgentsMappingResponse = ` + { + "items": [ + { + "id": "id1", + "display_name": "display_name1", + "group_id": "group_id1", + "registered_at": "registered_at1", + "usage": [ + { + "connection_id": "connection_id11", + "schema": "schema11", + "service": "service11" + }, + { + "connection_id": "connection_id12", + "schema": "schema12", + "service": "service12" + } + ] + }, + { + "id": "id2", + "display_name": "display_name2", + "group_id": "group_id2", + "registered_at": "registered_at2", + "usage": [ + { + "connection_id": "connection_id21", + "schema": "schema21", + "service": "service21" + }, + { + "connection_id": "connection_id22", + "schema": "schema22", + "service": "service22" + } + ] + } + ], + "next_cursor": null + }` +) + +func setupMockClientHybridDeploymentAgentsDataSourceConfigMapping(t *testing.T) { + tfmock.MockClient().Reset() + + hybridDeploymentAgentsDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents").ThenCall( + func(req *http.Request) (*http.Response, error) { + hybridDeploymentAgentsDataSourceMockData = tfmock.CreateMapFromJsonString(t, hybridDeploymentAgentsMappingResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", hybridDeploymentAgentsDataSourceMockData), nil + }, + ) +} + +func TestDataSourceHybridDeploymentAgentsMappingMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + data "fivetran_hybrid_deployment_agents" "test_lpa" { + provider = fivetran-provider + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, hybridDeploymentAgentsDataSourceMockGetHandler.Interactions, 1) + tfmock.AssertNotEmpty(t, hybridDeploymentAgentsDataSourceMockData) + return nil + }, + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.0.display_name", "display_name1"), + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.0.group_id", "group_id1"), + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.0.registered_at", "registered_at1"), + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.1.display_name", "display_name2"), + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.1.group_id", "group_id2"), + resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.1.registered_at", "registered_at2"), + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientHybridDeploymentAgentsDataSourceConfigMapping(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + return nil + }, + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/framework/datasources/local_processing_agent_test.go b/fivetran/framework/datasources/local_processing_agent_test.go deleted file mode 100644 index 66faa40c..00000000 --- a/fivetran/framework/datasources/local_processing_agent_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package datasources_test - -import ( - "net/http" - "testing" - - "github.com/fivetran/go-fivetran/tests/mock" - tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -var ( - lpaDataSourceMockGetHandler *mock.Handler - lpaDataSourceMockData map[string]interface{} -) - -const ( - lpaMappingResponse = ` - { - "id": "lpa_id", - "display_name": "display_name", - "group_id": "group_id", - "registered_at": "registered_at", - "usage": [ - { - "connection_id": "connection_id1", - "schema": "schema1", - "service": "service1" - }, - { - "connection_id": "connection_id2", - "schema": "schema2", - "service": "service2" - } - ] - } - ` -) - -func setupMockClientLocalProcessingAgentDataSourceConfigMapping(t *testing.T) { - tfmock.MockClient().Reset() - - lpaDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents/lpa_id").ThenCall( - func(req *http.Request) (*http.Response, error) { - lpaDataSourceMockData = tfmock.CreateMapFromJsonString(t, lpaMappingResponse) - return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", lpaDataSourceMockData), nil - }, - ) -} - -func TestDataSourceLocalProcessingAgentMappingMock(t *testing.T) { - step1 := resource.TestStep{ - Config: ` - data "fivetran_local_processing_agent" "test_lpa" { - provider = fivetran-provider - id = "lpa_id" - }`, - - Check: resource.ComposeAggregateTestCheckFunc( - func(s *terraform.State) error { - tfmock.AssertEqual(t, lpaDataSourceMockGetHandler.Interactions, 1) - tfmock.AssertNotEmpty(t, lpaDataSourceMockData) - return nil - }, - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "display_name", "display_name"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "group_id", "group_id"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "registered_at", "registered_at"), - /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.connection_id", "connection_id1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.schema", "schema1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.service", "service1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.connection_id", "connection_id2"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.schema", "schema2"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.service", "service2"),*/ - ), - } - - resource.Test( - t, - resource.TestCase{ - PreCheck: func() { - setupMockClientLocalProcessingAgentDataSourceConfigMapping(t) - }, - ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, - CheckDestroy: func(s *terraform.State) error { - return nil - }, - Steps: []resource.TestStep{ - step1, - }, - }, - ) -} diff --git a/fivetran/framework/datasources/local_processing_agents_test.go b/fivetran/framework/datasources/local_processing_agents_test.go deleted file mode 100644 index 259242d8..00000000 --- a/fivetran/framework/datasources/local_processing_agents_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package datasources_test - -import ( - "net/http" - "testing" - - "github.com/fivetran/go-fivetran/tests/mock" - tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -var ( - localProcessingAgentsDataSourceMockGetHandler *mock.Handler - localProcessingAgentsDataSourceMockData map[string]interface{} -) - -const ( - localProcessingAgentsMappingResponse = ` - { - "items": [ - { - "id": "id1", - "display_name": "display_name1", - "group_id": "group_id1", - "registered_at": "registered_at1", - "usage": [ - { - "connection_id": "connection_id11", - "schema": "schema11", - "service": "service11" - }, - { - "connection_id": "connection_id12", - "schema": "schema12", - "service": "service12" - } - ] - }, - { - "id": "id2", - "display_name": "display_name2", - "group_id": "group_id2", - "registered_at": "registered_at2", - "usage": [ - { - "connection_id": "connection_id21", - "schema": "schema21", - "service": "service21" - }, - { - "connection_id": "connection_id22", - "schema": "schema22", - "service": "service22" - } - ] - } - ], - "next_cursor": null - }` -) - -func setupMockClientLocalProcessingAgentsDataSourceConfigMapping(t *testing.T) { - tfmock.MockClient().Reset() - - localProcessingAgentsDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents").ThenCall( - func(req *http.Request) (*http.Response, error) { - localProcessingAgentsDataSourceMockData = tfmock.CreateMapFromJsonString(t, localProcessingAgentsMappingResponse) - return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", localProcessingAgentsDataSourceMockData), nil - }, - ) -} - -func TestDataSourceLocalProcessingAgentsMappingMock(t *testing.T) { - step1 := resource.TestStep{ - Config: ` - data "fivetran_local_processing_agents" "test_lpa" { - provider = fivetran-provider - }`, - - Check: resource.ComposeAggregateTestCheckFunc( - func(s *terraform.State) error { - tfmock.AssertEqual(t, localProcessingAgentsDataSourceMockGetHandler.Interactions, 1) - tfmock.AssertNotEmpty(t, localProcessingAgentsDataSourceMockData) - return nil - }, - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.display_name", "display_name1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.group_id", "group_id1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.registered_at", "registered_at1"), - /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.connection_id", "connection_id11"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.schema", "schema11"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.service", "service11"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.connection_id", "connection_id12"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.schema", "schema12"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.service", "service12"),*/ - - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.display_name", "display_name2"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.group_id", "group_id2"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.registered_at", "registered_at2"), - /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.connection_id", "connection_id21"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.schema", "schema21"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.service", "service21"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.connection_id", "connection_id22"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.schema", "schema22"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.service", "service22"),*/ - ), - } - - resource.Test( - t, - resource.TestCase{ - PreCheck: func() { - setupMockClientLocalProcessingAgentsDataSourceConfigMapping(t) - }, - ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, - CheckDestroy: func(s *terraform.State) error { - return nil - }, - Steps: []resource.TestStep{ - step1, - }, - }, - ) -} diff --git a/fivetran/framework/datasources/private_link.go b/fivetran/framework/datasources/private_link.go new file mode 100644 index 00000000..d506fe6d --- /dev/null +++ b/fivetran/framework/datasources/private_link.go @@ -0,0 +1,60 @@ +package datasources + +import ( + "context" + "fmt" + + "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core" + "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/model" + "github.com/hashicorp/terraform-plugin-framework/datasource" + + fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" +) + +func PrivateLink() datasource.DataSource { + return &privateLink{} +} + +// Ensure the implementation satisfies the desired interfaces. +var _ datasource.DataSourceWithConfigure = &privateLink{} + +type privateLink struct { + core.ProviderDatasource +} + +func (d *privateLink) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = "fivetran_private_link" +} + +func (d *privateLink) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = fivetranSchema.PrivateLinkDatasource() +} + +func (d *privateLink) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + if d.GetClient() == nil { + resp.Diagnostics.AddError( + "Unconfigured Fivetran Client", + "Please report this issue to the provider developers.", + ) + + return + } + + var data model.PrivateLink + + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + detailsResponse, err := d.GetClient().NewPrivateLinkDetails().PrivateLinkId(data.Id.ValueString()).Do(ctx) + + if err != nil { + resp.Diagnostics.AddError( + "Read error.", + fmt.Sprintf("%v; code: %v", err, detailsResponse.Code), + ) + return + } + + data.ReadFromResponse(ctx, detailsResponse) + + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} \ No newline at end of file diff --git a/fivetran/framework/datasources/private_link_test.go b/fivetran/framework/datasources/private_link_test.go new file mode 100644 index 00000000..40ebbda0 --- /dev/null +++ b/fivetran/framework/datasources/private_link_test.go @@ -0,0 +1,92 @@ +package datasources_test + +import ( + "net/http" + "testing" + + "github.com/fivetran/go-fivetran/tests/mock" + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +const ( + privateLinkMappingResponse = ` + { + "id": "id", + "name": "name", + "region": "region", + "service": "service", + "account_id": "account_id", + "cloud_provider": "cloud_provider", + "state": "state", + "state_summary": "state_summary", + "created_at": "created_at", + "created_by": "created_by", + "config": { + "connection_service_name": "connection_service_name" + } + } + ` +) + +var ( + privateLinkDataSourceMockGetHandler *mock.Handler + + privateLinkDataSourceMockData map[string]interface{} +) + +func setupMockClientPrivateLinkDataSourceConfigMapping(t *testing.T) { + tfmock.MockClient().Reset() + + privateLinkDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/private-links/id").ThenCall( + func(req *http.Request) (*http.Response, error) { + privateLinkDataSourceMockData = tfmock.CreateMapFromJsonString(t, privateLinkMappingResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", privateLinkDataSourceMockData), nil + }, + ) +} + +func TestDataSourcePrivateLinkConfigMappingMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + data "fivetran_private_link" "test_pl" { + provider = fivetran-provider + id = "id" + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, privateLinkDataSourceMockGetHandler.Interactions, 1) + tfmock.AssertNotEmpty(t, privateLinkDataSourceMockData) + return nil + }, + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "name", "name"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "region", "region"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "service", "service"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "cloud_provider", "cloud_provider"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "state", "state"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "state_summary", "state_summary"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "created_at", "created_at"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "created_by", "created_by"), + + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "config.connection_service_name", "connection_service_name"), + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientPrivateLinkDataSourceConfigMapping(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + return nil + }, + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/framework/datasources/local_processing_agents.go b/fivetran/framework/datasources/private_links.go similarity index 57% rename from fivetran/framework/datasources/local_processing_agents.go rename to fivetran/framework/datasources/private_links.go index 3b71d769..005bc5cf 100644 --- a/fivetran/framework/datasources/local_processing_agents.go +++ b/fivetran/framework/datasources/private_links.go @@ -7,31 +7,31 @@ import ( "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core" "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/model" "github.com/hashicorp/terraform-plugin-framework/datasource" - sdk "github.com/fivetran/go-fivetran/local_processing_agent" + sdk "github.com/fivetran/go-fivetran/private_link" fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" ) -func LocalProcessingAgents() datasource.DataSource { - return &localProcessingAgents{} +func PrivateLinks() datasource.DataSource { + return &privateLinks{} } // Ensure the implementation satisfies the desired interfaces. -var _ datasource.DataSourceWithConfigure = &localProcessingAgents{} +var _ datasource.DataSourceWithConfigure = &privateLinks{} -type localProcessingAgents struct { +type privateLinks struct { core.ProviderDatasource } -func (d *localProcessingAgents) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = "fivetran_local_processing_agents" +func (d *privateLinks) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = "fivetran_private_links" } -func (d *localProcessingAgents) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = fivetranSchema.LocalProcessingAgentsDatasource() +func (d *privateLinks) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = fivetranSchema.PrivateLinksDatasource() } -func (d *localProcessingAgents) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *privateLinks) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { if d.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -41,17 +41,17 @@ func (d *localProcessingAgents) Read(ctx context.Context, req datasource.ReadReq return } - var data model.LocalProcessingAgents + var data model.PrivateLinks resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) var respNextCursor string - var listResponse sdk.LocalProcessingAgentListResponse + var listResponse sdk.PrivateLinkListResponse limit := 1000 for { var err error - var tmpResp sdk.LocalProcessingAgentListResponse - svc := d.GetClient().NewLocalProcessingAgentList() + var tmpResp sdk.PrivateLinkListResponse + svc := d.GetClient().NewPrivateLinkList() if respNextCursor == "" { tmpResp, err = svc.Limit(limit).Do(ctx) @@ -66,7 +66,7 @@ func (d *localProcessingAgents) Read(ctx context.Context, req datasource.ReadReq "Read error.", fmt.Sprintf("%v; code: %v", err, tmpResp.Code), ) - listResponse = sdk.LocalProcessingAgentListResponse{} + listResponse = sdk.PrivateLinkListResponse{} } listResponse.Data.Items = append(listResponse.Data.Items, tmpResp.Data.Items...) @@ -81,4 +81,4 @@ func (d *localProcessingAgents) Read(ctx context.Context, req datasource.ReadReq data.ReadFromResponse(ctx, listResponse) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -} +} \ No newline at end of file diff --git a/fivetran/framework/datasources/private_links_test.go b/fivetran/framework/datasources/private_links_test.go new file mode 100644 index 00000000..cc603639 --- /dev/null +++ b/fivetran/framework/datasources/private_links_test.go @@ -0,0 +1,111 @@ +package datasources_test + +import ( + "net/http" + "testing" + + "github.com/fivetran/go-fivetran/tests/mock" + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +const ( + privateLinksMappingResponse = ` + { + "items": [ + { + "id": "id1", + "name": "name1", + "region": "region1", + "service": "service1", + "account_id": "account_id1", + "cloud_provider": "cloud_provider1", + "state": "state1", + "state_summary": "state_summary1", + "created_at": "created_at1", + "created_by": "created_by1" + }, + { + "id": "id2", + "name": "name2", + "region": "region2", + "service": "service2", + "account_id": "account_id2", + "cloud_provider": "cloud_provider2", + "state": "state2", + "state_summary": "state_summary2", + "created_at": "created_at2", + "created_by": "created_by2" + } + ], + "next_cursor": null + }` +) + +var ( + privateLinksDataSourceMockGetHandler *mock.Handler + + privateLinksDataSourceMockData map[string]interface{} +) + +func setupMockClientPrivateLinksDataSourceConfigMapping(t *testing.T) { + tfmock.MockClient().Reset() + + privateLinksDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/private-links").ThenCall( + func(req *http.Request) (*http.Response, error) { + privateLinksDataSourceMockData = tfmock.CreateMapFromJsonString(t, privateLinksMappingResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", privateLinksDataSourceMockData), nil + }, + ) +} + +func TestDataSourcePrivateLinksConfigMappingMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + data "fivetran_private_links" "test_pl" { + provider = fivetran-provider + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, privateLinksDataSourceMockGetHandler.Interactions, 1) + tfmock.AssertNotEmpty(t, privateLinksDataSourceMockData) + return nil + }, + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.name", "name1"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.region", "region1"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.service", "service1"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.cloud_provider", "cloud_provider1"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.state", "state1"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.state_summary", "state_summary1"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.created_at", "created_at1"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.0.created_by", "created_by1"), + + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.name", "name2"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.region", "region2"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.service", "service2"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.cloud_provider", "cloud_provider2"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.state", "state2"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.state_summary", "state_summary2"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.created_at", "created_at2"), + resource.TestCheckResourceAttr("data.fivetran_private_links.test_pl", "items.1.created_by", "created_by2"), + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientPrivateLinksDataSourceConfigMapping(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + return nil + }, + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/framework/provider.go b/fivetran/framework/provider.go index d29c966a..c5c88bdc 100644 --- a/fivetran/framework/provider.go +++ b/fivetran/framework/provider.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -const Version = "1.3.2" // Current provider version +const Version = "1.4.0" // Current provider version type fivetranProvider struct { mockClient httputils.HttpClient @@ -119,8 +119,9 @@ func (p *fivetranProvider) Resources(ctx context.Context) []func() resource.Reso resources.DbtProject, resources.DbtTransformation, resources.ProxyAgent, - resources.LocalProcessingAgent, + resources.HybridDeploymentAgent, resources.DbtGitProjectConfig, + resources.PrivateLink, } } @@ -158,7 +159,9 @@ func (p *fivetranProvider) DataSources(ctx context.Context) []func() datasource. datasources.DbtTransformation, datasources.ProxyAgent, datasources.ProxyAgents, - datasources.LocalProcessingAgent, - datasources.LocalProcessingAgents, + datasources.HybridDeploymentAgent, + datasources.HybridDeploymentAgents, + datasources.PrivateLink, + datasources.PrivateLinks, } } diff --git a/fivetran/framework/resources/connector.go b/fivetran/framework/resources/connector.go index 825c28a0..4ffa5339 100644 --- a/fivetran/framework/resources/connector.go +++ b/fivetran/framework/resources/connector.go @@ -45,7 +45,6 @@ func (r *connector) ImportState(ctx context.Context, req resource.ImportStateReq } func (r *connector) UpgradeState(ctx context.Context) map[int64]resource.StateUpgrader { - v0ConfigTfTypes := model.GetTfTypes(common.GetConfigFieldsMap(), 1) v0ConfigTfTypes["servers"] = tftypes.String @@ -70,6 +69,12 @@ func (r *connector) UpgradeState(ctx context.Context) map[int64]resource.StateUp upgradeConnectorState(ctx, req, resp, 2) }, }, + // State upgrade implementation from 2 (prior state version) to 4 (Schema.Version) + 3: { + StateUpgrader: func(ctx context.Context, req resource.UpgradeStateRequest, resp *resource.UpgradeStateResponse) { + upgradeConnectorState(ctx, req, resp, 3) + }, + }, } } @@ -153,8 +158,12 @@ func (r *connector) Create(ctx context.Context, req resource.CreateRequest, resp svc.NetworkingMethod(data.NetworkingMethod.ValueString()) } - if data.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(data.LocalProcessingAgentId.ValueString()) + if data.HybridDeploymentAgentId.ValueString() != "" { + svc.HybridDeploymentAgentId(data.HybridDeploymentAgentId.ValueString()) + } + + if data.PrivateLinkId.ValueString() != "" { + svc.PrivateLinkId(data.PrivateLinkId.ValueString()) } if !noAuth { @@ -317,8 +326,12 @@ func (r *connector) Update(ctx context.Context, req resource.UpdateRequest, resp TrustFingerprints(trustFingerprintsPlan). ConnectorID(state.Id.ValueString()) - if plan.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(plan.LocalProcessingAgentId.ValueString()) + if plan.HybridDeploymentAgentId.ValueString() != "" { + svc.HybridDeploymentAgentId(plan.HybridDeploymentAgentId.ValueString()) + } + + if plan.PrivateLinkId.ValueString() != "" { + svc.PrivateLinkId(plan.PrivateLinkId.ValueString()) } if len(patch) > 0 { diff --git a/fivetran/framework/resources/connector_migrations.go b/fivetran/framework/resources/connector_migrations.go index 5369aea8..a2fe091e 100644 --- a/fivetran/framework/resources/connector_migrations.go +++ b/fivetran/framework/resources/connector_migrations.go @@ -36,8 +36,8 @@ func upgradeConnectorState(ctx context.Context, req resource.UpgradeStateRequest } dynamicValue, err := tfprotov6.NewDynamicValue( - getConnectorStateModel(3), - tftypes.NewValue(getConnectorStateModel(3), map[string]tftypes.Value{ + getConnectorStateModel(4), + tftypes.NewValue(getConnectorStateModel(4), map[string]tftypes.Value{ "id": rawState["id"], "name": rawState["name"], "connected_by": rawState["connected_by"], @@ -47,7 +47,7 @@ func upgradeConnectorState(ctx context.Context, req resource.UpgradeStateRequest "timeouts": rawState["timeouts"], "networking_method": tftypes.NewValue(tftypes.String, nil), "proxy_agent_id": tftypes.NewValue(tftypes.String, nil), - "local_processing_agent_id": tftypes.NewValue(tftypes.String, nil), + "hybrid_deployment_agent_id": rawState["local_processing_agent_id"], "run_setup_tests": convertStringStateValueToBool("run_setup_tests", rawState["run_setup_tests"], resp.Diagnostics), "trust_fingerprints": convertStringStateValueToBool("trust_fingerprints", rawState["trust_fingerprints"], resp.Diagnostics), @@ -96,16 +96,15 @@ func getConnectorStateModel(version int) tftypes.Type { }, }, } - if version == 3 { + if version == 3 || version == 4 { base["destination_schema"] = dsObj base["run_setup_tests"] = tftypes.Bool base["trust_certificates"] = tftypes.Bool base["trust_fingerprints"] = tftypes.Bool - base["proxy_agent_id"] = tftypes.String base["networking_method"] = tftypes.String base["local_processing_agent_id"] = tftypes.String - + base["private_link_id"] = tftypes.String base["config"] = tftypes.Object{AttributeTypes: model.GetTfTypes(common.GetConfigFieldsMap(), 3)} base["auth"] = tftypes.Object{AttributeTypes: model.GetTfTypes(common.GetAuthFieldsMap(), 3)} } else { diff --git a/fivetran/framework/resources/destination.go b/fivetran/framework/resources/destination.go index 791f287c..820847cb 100644 --- a/fivetran/framework/resources/destination.go +++ b/fivetran/framework/resources/destination.go @@ -49,6 +49,11 @@ func (r *destination) UpgradeState(ctx context.Context) map[int64]resource.State upgradeDestinationState(ctx, req, resp, 0) }, }, + 1: { + StateUpgrader: func(ctx context.Context, req resource.UpgradeStateRequest, resp *resource.UpgradeStateResponse) { + upgradeDestinationState(ctx, req, resp, 1) + }, + }, } } @@ -100,12 +105,16 @@ func (r *destination) Create(ctx context.Context, req resource.CreateRequest, re DaylightSavingTimeEnabled(daylightSavingTimeEnabledPlan). ConfigCustom(&configMap) - if data.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(data.LocalProcessingAgentId.ValueString()) + if data.HybridDeploymentAgentId.ValueString() != "" { + svc.HybridDeploymentAgentId(data.HybridDeploymentAgentId.ValueString()) } if data.NetworkingMethod.ValueString() != "" { svc.NetworkingMethod(data.NetworkingMethod.ValueString()) + } + + if data.PrivateLinkId.ValueString() != "" { + svc.PrivateLinkId(data.PrivateLinkId.ValueString()) } response, err := svc. @@ -282,12 +291,16 @@ func (r *destination) Update(ctx context.Context, req resource.UpdateRequest, re Region(plan.Region.ValueString()). DestinationID(state.Id.ValueString()) - if plan.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(plan.LocalProcessingAgentId.ValueString()) + if plan.HybridDeploymentAgentId.ValueString() != "" { + svc.HybridDeploymentAgentId(plan.HybridDeploymentAgentId.ValueString()) } if plan.NetworkingMethod.ValueString() != "" { svc.NetworkingMethod(plan.NetworkingMethod.ValueString()) + } + + if plan.PrivateLinkId.ValueString() != "" { + svc.PrivateLinkId(plan.PrivateLinkId.ValueString()) } if len(patch) > 0 { diff --git a/fivetran/framework/resources/destination_migrations.go b/fivetran/framework/resources/destination_migrations.go index c49c0354..c4f492c4 100644 --- a/fivetran/framework/resources/destination_migrations.go +++ b/fivetran/framework/resources/destination_migrations.go @@ -32,8 +32,8 @@ func upgradeDestinationState(ctx context.Context, req resource.UpgradeStateReque } dynamicValue, err := tfprotov6.NewDynamicValue( - getDestinationStateModel(1), - tftypes.NewValue(getDestinationStateModel(1), map[string]tftypes.Value{ + getDestinationStateModel(2), + tftypes.NewValue(getDestinationStateModel(2), map[string]tftypes.Value{ "id": rawState["id"], "group_id": rawState["group_id"], "service": rawState["service"], @@ -42,8 +42,7 @@ func upgradeDestinationState(ctx context.Context, req resource.UpgradeStateReque "time_zone_offset": rawState["time_zone_offset"], "setup_status": rawState["setup_status"], "daylight_saving_time_enabled": tftypes.NewValue(tftypes.Bool, nil), - "local_processing_agent_id": tftypes.NewValue(tftypes.String, nil), - "networking_method": tftypes.NewValue(tftypes.String, nil), + "hybrid_deployment_agent_id": rawState["local_processing_agent_id"], "run_setup_tests": convertStringStateValueToBool("run_setup_tests", rawState["run_setup_tests"], resp.Diagnostics), "trust_fingerprints": convertStringStateValueToBool("trust_fingerprints", rawState["trust_fingerprints"], resp.Diagnostics), @@ -75,7 +74,7 @@ func getDestinationStateModel(version int) tftypes.Type { }, }, } - if version == 1 { + if version == 1 || version == 2 { base["run_setup_tests"] = tftypes.Bool base["trust_certificates"] = tftypes.Bool base["trust_fingerprints"] = tftypes.Bool diff --git a/fivetran/framework/resources/local_processing_agent.go b/fivetran/framework/resources/hybrid_deployment_agent.go similarity index 59% rename from fivetran/framework/resources/local_processing_agent.go rename to fivetran/framework/resources/hybrid_deployment_agent.go index 7f5b09db..e09604f5 100644 --- a/fivetran/framework/resources/local_processing_agent.go +++ b/fivetran/framework/resources/hybrid_deployment_agent.go @@ -11,31 +11,31 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" ) -func LocalProcessingAgent() resource.Resource { - return &localProcessingAgent{} +func HybridDeploymentAgent() resource.Resource { + return &hybridDeploymentAgent{} } -type localProcessingAgent struct { +type hybridDeploymentAgent struct { core.ProviderResource } // Ensure the implementation satisfies the desired interfaces. -var _ resource.ResourceWithConfigure = &localProcessingAgent{} -var _ resource.ResourceWithImportState = &localProcessingAgent{} +var _ resource.ResourceWithConfigure = &hybridDeploymentAgent{} +var _ resource.ResourceWithImportState = &hybridDeploymentAgent{} -func (r *localProcessingAgent) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_local_processing_agent" +func (r *hybridDeploymentAgent) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_hybrid_deployment_agent" } -func (r *localProcessingAgent) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = fivetranSchema.LocalProcessingAgentResource() +func (r *hybridDeploymentAgent) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = fivetranSchema.HybridDeploymentAgentResource() } -func (r *localProcessingAgent) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *hybridDeploymentAgent) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } -func (r *localProcessingAgent) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *hybridDeploymentAgent) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -45,7 +45,7 @@ func (r *localProcessingAgent) Create(ctx context.Context, req resource.CreateRe return } - var data model.LocalProcessingAgentResourceModel + var data model.HybridDeploymentAgentResourceModel // Read Terraform plan data into the model resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) @@ -54,7 +54,7 @@ func (r *localProcessingAgent) Create(ctx context.Context, req resource.CreateRe return } - svc := r.GetClient().NewLocalProcessingAgentCreate() + svc := r.GetClient().NewHybridDeploymentAgentCreate() svc.GroupId(data.GroupId.ValueString()) svc.DisplayName(data.DisplayName.ValueString()) svc.EnvType("DOCKER") @@ -63,7 +63,7 @@ func (r *localProcessingAgent) Create(ctx context.Context, req resource.CreateRe createResponse, err := svc.Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Create Local Processing Agent Resource.", + "Unable to Create Hybrid Deployment Agent Resource.", fmt.Sprintf("%v; code: %v; message: %v", err, createResponse.Code, createResponse.Message), ) @@ -75,7 +75,7 @@ func (r *localProcessingAgent) Create(ctx context.Context, req resource.CreateRe resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } -func (r *localProcessingAgent) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *hybridDeploymentAgent) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -85,16 +85,16 @@ func (r *localProcessingAgent) Read(ctx context.Context, req resource.ReadReques return } - var data model.LocalProcessingAgentResourceModel + var data model.HybridDeploymentAgentResourceModel // Read Terraform prior state data into the model resp.Diagnostics.Append(req.State.Get(ctx, &data)...) - readResponse, err := r.GetClient().NewLocalProcessingAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) + readResponse, err := r.GetClient().NewHybridDeploymentAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Read Local Processing Agent Resource.", + "Unable to Read Hybrid Deployment Agent Resource.", fmt.Sprintf("%v; code: %v", err, readResponse.Code), ) return @@ -105,7 +105,7 @@ func (r *localProcessingAgent) Read(ctx context.Context, req resource.ReadReques resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } -func (r *localProcessingAgent) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *hybridDeploymentAgent) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -115,17 +115,17 @@ func (r *localProcessingAgent) Update(ctx context.Context, req resource.UpdateRe return } - var plan, state model.LocalProcessingAgentResourceModel + var plan, state model.HybridDeploymentAgentResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - svc := r.GetClient().NewLocalProcessingAgentReAuth().AgentId(state.Id.ValueString()) + svc := r.GetClient().NewHybridDeploymentAgentReAuth().AgentId(state.Id.ValueString()) updateResponse, err := svc.Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Update Local Processing Agent Resource.", + "Unable to Update Hybrid Deployment Agent Resource.", fmt.Sprintf("%v; code: %v; message: %v", err, updateResponse.Code, updateResponse.Message), ) return @@ -136,7 +136,7 @@ func (r *localProcessingAgent) Update(ctx context.Context, req resource.UpdateRe resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) } -func (r *localProcessingAgent) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *hybridDeploymentAgent) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -146,14 +146,14 @@ func (r *localProcessingAgent) Delete(ctx context.Context, req resource.DeleteRe return } - var data model.LocalProcessingAgentResourceModel + var data model.HybridDeploymentAgentResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &data)...) - deleteResponse, err := r.GetClient().NewLocalProcessingAgentDelete().AgentId(data.Id.ValueString()).Do(ctx) + deleteResponse, err := r.GetClient().NewHybridDeploymentAgentDelete().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Delete Local Processing Agent Resource.", + "Unable to Delete Hybrid Deployment Agent Resource.", fmt.Sprintf("%v; code: %v; message: %v", err, deleteResponse.Code, deleteResponse.Message), ) return diff --git a/fivetran/framework/resources/hybrid_deployment_agent_test.go b/fivetran/framework/resources/hybrid_deployment_agent_test.go new file mode 100644 index 00000000..e5bc0ef9 --- /dev/null +++ b/fivetran/framework/resources/hybrid_deployment_agent_test.go @@ -0,0 +1,95 @@ +package resources_test + +import ( + "net/http" + "testing" + + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/fivetran/go-fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var ( + hybridDeploymentAgentPostHandler *mock.Handler + hybridDeploymentAgentDeleteHandler *mock.Handler + hybridDeploymentAgentData map[string]interface{} +) + +func setupMockClientHybridDeploymentAgentResource(t *testing.T) { + tfmock.MockClient().Reset() + hybridDeploymentAgentResponse := + `{ + "id": "lpa_id", + "display_name": "display_name", + "group_id": "group_id", + "registered_at": "registered_at", + "files": { + "config_json": "config_json", + "auth_json": "auth_json", + "docker_compose_yaml": "docker_compose_yaml" + } + }` + + hybridDeploymentAgentPostHandler = tfmock.MockClient().When(http.MethodPost, "/v1/hybrid-deployment-agents").ThenCall( + func(req *http.Request) (*http.Response, error) { + hybridDeploymentAgentData = tfmock.CreateMapFromJsonString(t, hybridDeploymentAgentResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusCreated, "Hybrid Deployment Agent has been created", hybridDeploymentAgentData), nil + }, + ) + + tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "", hybridDeploymentAgentData), nil + }, + ) + + hybridDeploymentAgentDeleteHandler = tfmock.MockClient().When(http.MethodDelete, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + return tfmock.FivetranSuccessResponse(t, req, 200, "Hybrid Deployment Agent has been deleted", nil), nil + }, + ) +} + +func TestResourceHybridDeploymentAgentMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + resource "fivetran_hybrid_deployment_agent" "test_lpa" { + provider = fivetran-provider + + display_name = "display_name" + group_id = "group_id" + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, hybridDeploymentAgentPostHandler.Interactions, 1) + return nil + }, + resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "display_name", "display_name"), + resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "group_id", "group_id"), + resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "registered_at", "registered_at"), + resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "config_json", "config_json"), + resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "auth_json", "auth_json"), + resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "docker_compose_yaml", "docker_compose_yaml"), + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientHybridDeploymentAgentResource(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + tfmock.AssertEqual(t, hybridDeploymentAgentDeleteHandler.Interactions, 1) + return nil + }, + + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/framework/resources/local_processing_agent_test.go b/fivetran/framework/resources/local_processing_agent_test.go deleted file mode 100644 index 97a804bb..00000000 --- a/fivetran/framework/resources/local_processing_agent_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package resources_test - -import ( - "net/http" - "testing" - - tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" - "github.com/fivetran/go-fivetran/tests/mock" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -var ( - localProcessingAgentPostHandler *mock.Handler - localProcessingAgentDeleteHandler *mock.Handler - localProcessingAgentData map[string]interface{} -) - -func setupMockClientLocalProcessingAgentResource(t *testing.T) { - tfmock.MockClient().Reset() - localProcessingAgentResponse := - `{ - "id": "lpa_id", - "display_name": "display_name", - "group_id": "group_id", - "registered_at": "registered_at", - "files": { - "config_json": "config_json", - "auth_json": "auth_json", - "docker_compose_yaml": "docker_compose_yaml" - } - }` - - localProcessingAgentPostHandler = tfmock.MockClient().When(http.MethodPost, "/v1/local-processing-agents").ThenCall( - func(req *http.Request) (*http.Response, error) { - localProcessingAgentData = tfmock.CreateMapFromJsonString(t, localProcessingAgentResponse) - return tfmock.FivetranSuccessResponse(t, req, http.StatusCreated, "Local Processing Agent has been created", localProcessingAgentData), nil - }, - ) - - tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents/lpa_id").ThenCall( - func(req *http.Request) (*http.Response, error) { - return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "", localProcessingAgentData), nil - }, - ) - - localProcessingAgentDeleteHandler = tfmock.MockClient().When(http.MethodDelete, "/v1/local-processing-agents/lpa_id").ThenCall( - func(req *http.Request) (*http.Response, error) { - return tfmock.FivetranSuccessResponse(t, req, 200, "Local Processing Agent has been deleted", nil), nil - }, - ) -} - -func TestResourceLocalProcessingAgentMock(t *testing.T) { - step1 := resource.TestStep{ - Config: ` - resource "fivetran_local_processing_agent" "test_lpa" { - provider = fivetran-provider - - display_name = "display_name" - group_id = "group_id" - }`, - - Check: resource.ComposeAggregateTestCheckFunc( - func(s *terraform.State) error { - tfmock.AssertEqual(t, localProcessingAgentPostHandler.Interactions, 1) - return nil - }, - resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "display_name", "display_name"), - resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "group_id", "group_id"), - resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "registered_at", "registered_at"), - resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "config_json", "config_json"), - resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "auth_json", "auth_json"), - resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "docker_compose_yaml", "docker_compose_yaml"), - ), - } - - resource.Test( - t, - resource.TestCase{ - PreCheck: func() { - setupMockClientLocalProcessingAgentResource(t) - }, - ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, - CheckDestroy: func(s *terraform.State) error { - tfmock.AssertEqual(t, localProcessingAgentDeleteHandler.Interactions, 1) - return nil - }, - - Steps: []resource.TestStep{ - step1, - }, - }, - ) -} diff --git a/fivetran/framework/resources/private_link.go b/fivetran/framework/resources/private_link.go new file mode 100644 index 00000000..036df225 --- /dev/null +++ b/fivetran/framework/resources/private_link.go @@ -0,0 +1,167 @@ +package resources + +import ( + "context" + "fmt" + + "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core" + "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/model" + fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +func PrivateLink() resource.Resource { + return &privateLink{} +} + +type privateLink struct { + core.ProviderResource +} + +// Ensure the implementation satisfies the desired interfaces. +var _ resource.ResourceWithConfigure = &privateLink{} +var _ resource.ResourceWithImportState = &privateLink{} + +func (r *privateLink) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_private_link" +} + +func (r *privateLink) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = fivetranSchema.PrivateLinkResource() +} + +func (r *privateLink) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) +} + +func (r *privateLink) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + if r.GetClient() == nil { + resp.Diagnostics.AddError( + "Unconfigured Fivetran Client", + "Please report this issue to the provider developers.", + ) + + return + } + + var data model.PrivateLink + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + svc := r.GetClient().NewPrivateLinkCreate() + svc.Region(data.Region.ValueString()) + svc.Service(data.Service.ValueString()) + svc.Name(data.Name.ValueString()) + + config := data.GetConfig() + svc.ConfigCustom(&config) + + createResponse, err := svc.DoCustom(ctx) + if err != nil { + resp.Diagnostics.AddError( + "Unable to Create Private Link Resource.", + fmt.Sprintf("%v; code: %v; message: %v", err, createResponse.Code, createResponse.Message), + ) + + return + } + + data.ReadFromCustomResponse(ctx, createResponse) + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +func (r *privateLink) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + if r.GetClient() == nil { + resp.Diagnostics.AddError( + "Unconfigured Fivetran Client", + "Please report this issue to the provider developers.", + ) + + return + } + + var data model.PrivateLink + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + readResponse, err := r.GetClient().NewPrivateLinkDetails().PrivateLinkId(data.Id.ValueString()).DoCustom(ctx) + + if err != nil { + resp.Diagnostics.AddError( + "Unable to Read Private Link Resource.", + fmt.Sprintf("%v; code: %v", err, readResponse.Code), + ) + return + } + + data.ReadFromCustomResponse(ctx, readResponse) + + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +func (r *privateLink) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + resp.Diagnostics.AddError( + "Update Private Link does not support", + "Please report this issue to the provider developers.", + ) + return + + var plan, state model.PrivateLink + hasChanges := false + + svc := r.GetClient().NewPrivateLinkModify().PrivateLinkId(state.Id.ValueString()) + + if !plan.Config.Equal(state.Config) { + config := plan.GetConfig() + svc.ConfigCustom(&config) + hasChanges = true + } + + if hasChanges { + updateResponse, err := svc.DoCustom(ctx) + + if err != nil { + resp.Diagnostics.AddError( + "Unable to Update Private Link Resource.", + fmt.Sprintf("%v; code: %v; message: %v", err, updateResponse.Code, updateResponse.Message), + ) + return + } + + state.ReadFromCustomResponse(ctx, updateResponse) + } + + + resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) +} + +func (r *privateLink) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + if r.GetClient() == nil { + resp.Diagnostics.AddError( + "Unconfigured Fivetran Client", + "Please report this issue to the provider developers.", + ) + + return + } + + var data model.PrivateLink + + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + deleteResponse, err := r.GetClient().NewPrivateLinkDelete().PrivateLinkId(data.Id.ValueString()).Do(ctx) + if err != nil { + resp.Diagnostics.AddError( + "Unable to Delete Private Link Resource.", + fmt.Sprintf("%v; code: %v; message: %v", err, deleteResponse.Code, deleteResponse.Message), + ) + return + } +} diff --git a/fivetran/framework/resources/private_link_test.go b/fivetran/framework/resources/private_link_test.go new file mode 100644 index 00000000..4fd931e9 --- /dev/null +++ b/fivetran/framework/resources/private_link_test.go @@ -0,0 +1,104 @@ +package resources_test + +import ( + "net/http" + "testing" + + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/fivetran/go-fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var ( + privateLinkPostHandler *mock.Handler + privateLinkPatchHandler *mock.Handler + privateLinkDeleteHandler *mock.Handler + privateLinkData map[string]interface{} +) + +func setupMockClientPrivateLinkResource(t *testing.T) { + tfmock.MockClient().Reset() + privateLinkResponse := + `{ + "id": "pl_id", + "name": "name", + "region": "region", + "service": "service", + "account_id": "account_id", + "cloud_provider": "cloud_provider", + "state": "state", + "state_summary": "state_summary", + "created_at": "created_at", + "created_by": "created_by", + "config": { + "connection_service_name": "connection_service_name" + } + }` + + + privateLinkPostHandler = tfmock.MockClient().When(http.MethodPost, "/v1/private-links").ThenCall( + func(req *http.Request) (*http.Response, error) { + privateLinkData = tfmock.CreateMapFromJsonString(t, privateLinkResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusCreated, "PrivateLink has been created", privateLinkData), nil + }, + ) + + tfmock.MockClient().When(http.MethodGet, "/v1/private-links/pl_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "", privateLinkData), nil + }, + ) + + privateLinkDeleteHandler = tfmock.MockClient().When(http.MethodDelete, "/v1/private-links/pl_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + return tfmock.FivetranSuccessResponse(t, req, 200, "PrivateLink has been deleted", nil), nil + }, + ) +} + +func TestResourcePrivateLinkMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + resource "fivetran_private_link" "test_pl" { + provider = fivetran-provider + + name = "name" + region = "region" + service = "service" + + config { + connection_service_name = "connection_service_name" + } + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, privateLinkPostHandler.Interactions, 1) + return nil + }, + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "name", "name"), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "region", "region"), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "service", "service"), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config.connection_service_name", "connection_service_name"), + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientPrivateLinkResource(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + tfmock.AssertEqual(t, privateLinkDeleteHandler.Interactions, 1) + return nil + }, + + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/tests/e2e/fivetran_test.go b/fivetran/tests/e2e/fivetran_test.go index 9d29bcbc..79d5506e 100644 --- a/fivetran/tests/e2e/fivetran_test.go +++ b/fivetran/tests/e2e/fivetran_test.go @@ -89,7 +89,8 @@ func cleanupAccount() { cleanupWebhooks() cleanupTeams() cleanupProxyAgents() - cleanupLocalProcessingAgents() + cleanupPrivateLinks() + cleanupHybridDeploymentAgents() } func isPredefinedUserExist() bool { @@ -277,19 +278,36 @@ func cleanupProxyAgents() { } } -func cleanupLocalProcessingAgents() { - lpaList, err := client.NewLocalProcessingAgentList().Do(context.Background()) +func cleanupPrivateLinks() { + plList, err := client.NewPrivateLinkList().Do(context.Background()) + if err != nil { + log.Fatal(err) + } + for _, pl := range plList.Data.Items { + _, err := client.NewPrivateLinkDelete().PrivateLinkId(pl.Id).Do(context.Background()) + if err != nil { + log.Fatal(err) + } + } + + if plList.Data.NextCursor != "" { + cleanupPrivateLinks() + } +} + +func cleanupHybridDeploymentAgents() { + lpaList, err := client.NewHybridDeploymentAgentList().Do(context.Background()) if err != nil { log.Fatal(err) } for _, lpa := range lpaList.Data.Items { - _, err := client.NewLocalProcessingAgentDelete().AgentId(lpa.Id).Do(context.Background()) + _, err := client.NewHybridDeploymentAgentDelete().AgentId(lpa.Id).Do(context.Background()) if err != nil { log.Fatal(err) } } if lpaList.Data.NextCursor != "" { - cleanupLocalProcessingAgents() + cleanupHybridDeploymentAgents() } } diff --git a/fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go b/fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go new file mode 100644 index 00000000..14df6aa2 --- /dev/null +++ b/fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go @@ -0,0 +1,73 @@ +package e2e_test + +import ( + "context" + "errors" + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +func TestResourceHybridDeploymentAgentE2E(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() {}, + ProtoV6ProviderFactories: ProtoV6ProviderFactories, + CheckDestroy: testFivetranHybridDeploymentAgentResourceDestroy, + Steps: []resource.TestStep{ + { + Config: ` + resource "fivetran_group" "testgroup" { + provider = fivetran-provider + name = "TestResourceHybridDeploymentAgentE2E" + } + + resource "fivetran_hybrid_deployment_agent" "test_lpa" { + provider = fivetran-provider + + display_name = "TestResourceHybridDeploymentAgentE2E" + group_id = fivetran_group.testgroup.id + }`, + Check: resource.ComposeAggregateTestCheckFunc( + testFivetranHybridDeploymentAgentResourceCreate(t, "fivetran_hybrid_deployment_agent.test_lpa"), + resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "display_name", "TestResourceHybridDeploymentAgentE2E"), + ), + }, + }, + }) +} + +func testFivetranHybridDeploymentAgentResourceCreate(t *testing.T, resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs := GetResource(t, s, resourceName) + + _, err := client.NewHybridDeploymentAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) + if err != nil { + fmt.Println(err) + return err + } + //todo: check response _ fields if needed + return nil + } +} + +func testFivetranHybridDeploymentAgentResourceDestroy(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "fivetran_hybrid_deployment_agent" { + continue + } + + response, err := client.NewHybridDeploymentAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) + if err.Error() != "status code: 404; expected: 200" { + return err + } + if !strings.HasPrefix(response.Code, "NotFound") { + return errors.New("Hybrid Deployment Agent " + rs.Primary.ID + " still exists. Response code: " + response.Code) + } + + } + + return nil +} diff --git a/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go b/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go deleted file mode 100644 index 256a75db..00000000 --- a/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package e2e_test - -import ( - "context" - "errors" - "fmt" - "strings" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -func TestResourceLocalProcessingAgentE2E(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() {}, - ProtoV6ProviderFactories: ProtoV6ProviderFactories, - CheckDestroy: testFivetranLocalProcessingAgentResourceDestroy, - Steps: []resource.TestStep{ - { - Config: ` - resource "fivetran_group" "testgroup" { - provider = fivetran-provider - name = "TestResourceLocalProcessingAgentE2E" - } - - resource "fivetran_local_processing_agent" "test_lpa" { - provider = fivetran-provider - - display_name = "TestResourceLocalProcessingAgentE2E" - group_id = fivetran_group.testgroup.id - }`, - Check: resource.ComposeAggregateTestCheckFunc( - testFivetranLocalProcessingAgentResourceCreate(t, "fivetran_local_processing_agent.test_lpa"), - resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "display_name", "TestResourceLocalProcessingAgentE2E"), - ), - }, - }, - }) -} - -func testFivetranLocalProcessingAgentResourceCreate(t *testing.T, resourceName string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs := GetResource(t, s, resourceName) - - _, err := client.NewLocalProcessingAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) - if err != nil { - fmt.Println(err) - return err - } - //todo: check response _ fields if needed - return nil - } -} - -func testFivetranLocalProcessingAgentResourceDestroy(s *terraform.State) error { - for _, rs := range s.RootModule().Resources { - if rs.Type != "fivetran_local_processing_agent" { - continue - } - - response, err := client.NewLocalProcessingAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) - if err.Error() != "status code: 404; expected: 200" { - return err - } - if !strings.HasPrefix(response.Code, "NotFound") { - return errors.New("Local Processing Agent " + rs.Primary.ID + " still exists. Response code: " + response.Code) - } - - } - - return nil -} diff --git a/fivetran/tests/e2e/resource_private_link_e2e_test.go b/fivetran/tests/e2e/resource_private_link_e2e_test.go new file mode 100644 index 00000000..04e963d3 --- /dev/null +++ b/fivetran/tests/e2e/resource_private_link_e2e_test.go @@ -0,0 +1,70 @@ +package e2e_test + +import ( + "context" + "fmt" + "strconv" + "testing" + "math/rand" + "time" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var resourceConfig = ` + resource "fivetran_private_link" "test_pl" { + provider = fivetran-provider + + name = "%v" + region = "AWS_US_EAST_1" + service = "REDSHIFT_AWS" + + config { + aws_account_id = "%v" + cluster_identifier = "%v" + } + }` + +var seededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano())) + +func TestResourcePrivateLinkE2E(t *testing.T) { + t.Skip("Private links have a strict limit on the number of entities created. This test should only be used for intermediate tests when changes are made directly to Private links.") + suffix := strconv.Itoa(seededRand.Int()) + privateLinkName := suffix + privateLinkCfgValue := "privatelink_" + suffix + + resourceConfig = fmt.Sprintf(resourceConfig, privateLinkName, privateLinkCfgValue, privateLinkCfgValue) + + resource.Test(t, resource.TestCase{ + PreCheck: func() {}, + ProtoV6ProviderFactories: ProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: resourceConfig, + Check: resource.ComposeAggregateTestCheckFunc( + testFivetranPrivateLinkResourceCreate(t, "fivetran_private_link.test_pl"), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "name", privateLinkName), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "region", "AWS_US_EAST_1"), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "service", "REDSHIFT_AWS"), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config.aws_account_id", privateLinkCfgValue), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config.cluster_identifier", privateLinkCfgValue), + ), + }, + }, + }) +} + +func testFivetranPrivateLinkResourceCreate(t *testing.T, resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs := GetResource(t, s, resourceName) + + _, err := client.NewPrivateLinkDetails().PrivateLinkId(rs.Primary.ID).Do(context.Background()) + if err != nil { + fmt.Println(err) + return err + } + //todo: check response _ fields if needed + return nil + } +} \ No newline at end of file diff --git a/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go b/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go index 490c2fb7..d0f86aff 100644 --- a/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go +++ b/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go @@ -219,6 +219,7 @@ func getJsonConfigForFieldImpl(fieldName, service string, field common.ConfigFie } func getTfDestinationSchema(service string) string { + schemaFields := common.GetDestinationSchemaFields() if schemaFields[service]["schema"] { if schemaFields[service]["table"] { @@ -336,7 +337,7 @@ func TestResourceConnectorDynamicMapping(t *testing.T) { for len(*restFields) > 0 { stepFields, rest, service := fetchFieldsBatchByService(*restFields) - fmt.Printf("Fields left to test: %v | Step fields count: %v | Fields rest %v \n", len(rest)+len(stepFields), len(stepFields), len(rest)) + fmt.Printf("Service %v | Fields left to test: %v | Step fields count: %v | Fields rest %v \n", service, len(rest)+len(stepFields), len(stepFields), len(rest)) if debug { fmt.Printf("Testing fields for service %v : [\t\n%v]\n", service, strings.Join(stepFields, "\t\n ")) diff --git a/go.mod b/go.mod index fa4d2459..9853d1ac 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,24 @@ module github.com/fivetran/terraform-provider-fivetran require ( - github.com/fivetran/go-fivetran v0.9.4 - github.com/hashicorp/terraform-plugin-framework v1.8.0 + github.com/fivetran/go-fivetran v1.0.2 + github.com/hashicorp/terraform-plugin-framework v1.12.0 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 - github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 - github.com/hashicorp/terraform-plugin-testing v1.7.0 + github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 + github.com/hashicorp/terraform-plugin-testing v1.10.0 ) require ( - github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect + github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect - github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 // indirect + github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - golang.org/x/mod v0.15.0 // indirect - golang.org/x/tools v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect + golang.org/x/mod v0.19.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect ) require ( @@ -31,17 +31,17 @@ require ( github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect - github.com/hashicorp/go-hclog v1.6.2 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.6.3 // indirect - github.com/hashicorp/hcl/v2 v2.20.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/hashicorp/hc-install v0.8.0 // indirect + github.com/hashicorp/hcl/v2 v2.21.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.20.0 // indirect - github.com/hashicorp/terraform-json v0.21.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.22.2 + github.com/hashicorp/terraform-exec v0.21.0 // indirect + github.com/hashicorp/terraform-json v0.22.1 // indirect + github.com/hashicorp/terraform-plugin-go v0.24.0 github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect @@ -56,16 +56,16 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.0.0 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/zclconf/go-cty v1.14.3 // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect + github.com/zclconf/go-cty v1.15.0 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/grpc v1.66.2 // indirect + google.golang.org/protobuf v1.34.2 // indirect ) -go 1.21 +go 1.22.0 toolchain go1.22.1 diff --git a/go.sum b/go.sum index 56018fee..7093a704 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -30,6 +31,12 @@ github.com/fivetran/go-fivetran v0.9.2 h1:H3AY9nB3mJ7Kjd2vzT3bQfko5JZ/vVYu1zuM47 github.com/fivetran/go-fivetran v0.9.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/fivetran/go-fivetran v0.9.4 h1:9F7XzoezZxnhCW331NpN49ace8YfsJ8+92oyjxIj88o= github.com/fivetran/go-fivetran v0.9.4/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= +github.com/fivetran/go-fivetran v1.0.0 h1:dqGtgFlPBTxTrQlxMlsTYP17gV0BcLmkE+81KcDbTAg= +github.com/fivetran/go-fivetran v1.0.0/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= +github.com/fivetran/go-fivetran v1.0.1 h1:5qrqUIXPkAqH+IAN6jWzS51fH/BC7rKfViVyUNUUKU0= +github.com/fivetran/go-fivetran v1.0.1/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= +github.com/fivetran/go-fivetran v1.0.2 h1:AowFVwhQuPXqqdIVcQRcFqUbslYh2dZ+JVg2/9YTcvY= +github.com/fivetran/go-fivetran v1.0.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= @@ -61,39 +68,56 @@ github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUK github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= +github.com/hashicorp/hc-install v0.8.0/go.mod h1:+MwJYjDfCruSD/udvBmRB22Nlkwwkwf5sAB6uTIhSaU= github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= +github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= +github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= +github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI= github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY= +github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= +github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1/go.mod h1:MsjL1sQ9L7wGwzJ5RjcI6FzEMdyoBnw+XK8ZnOvQOLY= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= +github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 h1:3PCn9iyzdVOgHYOBmncpSSOxjQhCTYmc+PGvbdlqSaI= +github.com/hashicorp/terraform-plugin-framework-validators v0.14.0/go.mod h1:LwDKNdzxrDY/mHBrlC6aYfE2fQ3Dk3gaJD64vNiXvo4= github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= +github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= +github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= +github.com/hashicorp/terraform-plugin-testing v1.10.0/go.mod h1:iWRW3+loP33WMch2P/TEyCxxct/ZEcCGMquSLSCVsrc= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= @@ -161,19 +185,24 @@ github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -193,6 +222,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -202,11 +233,14 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -214,12 +248,18 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/templates/data-sources/hybrid_deployment_agent.md.tmpl b/templates/data-sources/hybrid_deployment_agent.md.tmpl new file mode 100644 index 00000000..8ee13508 --- /dev/null +++ b/templates/data-sources/hybrid_deployment_agent.md.tmpl @@ -0,0 +1,17 @@ +--- +page_title: "Data Source: fivetran_hybrid_deployment_agents" +--- + +# Data Source: fivetran_hybrid_deployment_agents + +This data source returns a hybrid deployment agent object. + +## Example Usage + +```hcl +data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agent" { + id = "hybrid_deployment_agent_id" +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/hybrid_deployment_agents.md.tmpl b/templates/data-sources/hybrid_deployment_agents.md.tmpl new file mode 100644 index 00000000..7294d850 --- /dev/null +++ b/templates/data-sources/hybrid_deployment_agents.md.tmpl @@ -0,0 +1,16 @@ +--- +page_title: "Data Source: fivetran_hybrid_deployment_agents" +--- + +# Data Source: fivetran_hybrid_deployment_agents + +This data source returns a list of all hybrid deployment agents within your Fivetran account. + +## Example Usage + +```hcl +data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agents" { +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/local_processing_agent.md.tmpl b/templates/data-sources/local_processing_agent.md.tmpl deleted file mode 100644 index d7c96016..00000000 --- a/templates/data-sources/local_processing_agent.md.tmpl +++ /dev/null @@ -1,17 +0,0 @@ ---- -page_title: "Data Source: fivetran_local_processing_agent" ---- - -# Data Source: fivetran_local_processing_agent - -This data source returns a local processing agent object. - -## Example Usage - -```hcl -data "fivetran_local_processing_agent" "local_processing_agent" { - id = "local_processing_agent_id" -} -``` - -{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/local_processing_agents.md.tmpl b/templates/data-sources/local_processing_agents.md.tmpl deleted file mode 100644 index 59658a16..00000000 --- a/templates/data-sources/local_processing_agents.md.tmpl +++ /dev/null @@ -1,16 +0,0 @@ ---- -page_title: "Data Source: fivetran_local_processing_agents" ---- - -# Data Source: fivetran_local_processing_agents - -This data source returns a list of all local processing agents within your Fivetran account. - -## Example Usage - -```hcl -data "fivetran_local_processing_agents" "local_processing_agents" { -} -``` - -{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/private_link.md.tmpl b/templates/data-sources/private_link.md.tmpl new file mode 100644 index 00000000..6839b3a2 --- /dev/null +++ b/templates/data-sources/private_link.md.tmpl @@ -0,0 +1,17 @@ +--- +page_title: "Data Source: fivetran_private_link" +--- + +# Data Source: fivetran_private_link + +This data source returns a private link object. + +## Example Usage + +```hcl +data "fivetran_private_link" "private_link" { + id = "private_link_id" +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/private_links.md.tmpl b/templates/data-sources/private_links.md.tmpl new file mode 100644 index 00000000..7b7387c7 --- /dev/null +++ b/templates/data-sources/private_links.md.tmpl @@ -0,0 +1,16 @@ +--- +page_title: "Data Source: fivetran_private_links" +--- + +# Data Source: fivetran_private_links + +This data source returns a list of all private links within your Fivetran account. + +## Example Usage + +```hcl +data "fivetran_private_links" "private_links" { +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/guides/version_1.4.0_update_guides.md.tmpl b/templates/guides/version_1.4.0_update_guides.md.tmpl new file mode 100644 index 00000000..46babea8 --- /dev/null +++ b/templates/guides/version_1.4.0_update_guides.md.tmpl @@ -0,0 +1,64 @@ +---- +page_title: "Version Update 1.4.0" +subcategory: "Upgrade Guides" +--- + +# Version 1.4.0 + +## What's new in 1.4.0 + +In version `1.4.0` of Fivetran Terraform provider, resource `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent` + +## Migration guide + +### Provider + +Update your provider configuration in the following way: + +Previous configuration: + +```hcl +required_providers { + fivetran = { + version = "~> 1.3.0" + source = "fivetran/fivetran" + } + } +``` + +Updated configuration: + +```hcl +required_providers { + fivetran = { + version = ">= 1.4.0" + source = "fivetran/fivetran" + } + } +``` + +### Resource `fivetran_hybrid_deployment_agent` + +Update all your connector schema config resources (`fivetran_local_processing_agent`): + +Previous configuration: + +```hcl +resource "fivetran_local_processing_agent" "test_agent" { +} +``` + +Updated configuration: + +```hcl +resource "fivetran_hybrid_deployment_agent" "test_agent" { +} +``` + +### Update terraform state + +Once all configurations have been updated, run: + +``` +terraform init -upgrade +``` \ No newline at end of file diff --git a/templates/resources/hybrid_deployment_agent.md.tmpl b/templates/resources/hybrid_deployment_agent.md.tmpl new file mode 100644 index 00000000..aa914962 --- /dev/null +++ b/templates/resources/hybrid_deployment_agent.md.tmpl @@ -0,0 +1,21 @@ +--- +page_title: "Resource: fivetran_hybrid_deployment_agent" +--- + +# Resource: fivetran_hybrid_deployment_agent + +This resource allows you to create, update, and delete hybrid deployment agents. + +## Example Usage + +```hcl +resource "fivetran_hybrid_deployment_agent" "hybrid_deployment_agent" { + provider = fivetran-provider + + display_name = "display_name" + group_id = "group_id" + auth_type = "AUTO" +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/resources/local_processing_agent.md.tmpl b/templates/resources/local_processing_agent.md.tmpl deleted file mode 100644 index db3137ed..00000000 --- a/templates/resources/local_processing_agent.md.tmpl +++ /dev/null @@ -1,20 +0,0 @@ ---- -page_title: "Resource: fivetran_local_processing_agent" ---- - -# Resource: fivetran_local_processing_agent - -This resource allows you to create, update, and delete local processing agents. - -## Example Usage - -```hcl -resource "fivetran_local_processing_agent" "test_lpa" { - provider = fivetran-provider - - display_name = "display_name" - group_id = "group_id" -} -``` - -{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/resources/private_link.md.tmpl b/templates/resources/private_link.md.tmpl new file mode 100644 index 00000000..2a09150c --- /dev/null +++ b/templates/resources/private_link.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "Resource: fivetran_private_link" +--- + +# Resource: fivetran_private_link + +This resource allows you to create, update, and delete private links. + +## Example Usage + +```hcl +resource "fivetran_private_link" "test_pl" { + provider = fivetran-provider + + name = "name" + region = "region" + service = "service" + + config { + connection_service_name = "connection_service_name" + } +} +``` + +{{ .SchemaMarkdown | trimspace }} From 828341d81599a4626b92d37ed505ff6f42536211 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 12:40:29 +0100 Subject: [PATCH 02/21] Revert hda --- docs/data-sources/hybrid_deployment_agent.md | 29 --------- docs/data-sources/hybrid_deployment_agents.md | 35 ---------- docs/data-sources/local_processing_agent.md | 38 +++++++++++ docs/data-sources/local_processing_agents.md | 44 +++++++++++++ .../hybrid_deployment_agent.md.tmpl | 17 ----- .../hybrid_deployment_agents.md.tmpl | 16 ----- .../local_processing_agent.md.tmpl | 17 +++++ .../local_processing_agents.md.tmpl | 16 +++++ .../version_1.4.0_update_guides.md.tmpl | 64 ------------------- .../resources/hybrid_deployment_agent.md.tmpl | 21 ------ .../resources/local_processing_agent.md.tmpl | 20 ++++++ 11 files changed, 135 insertions(+), 182 deletions(-) delete mode 100644 docs/data-sources/hybrid_deployment_agent.md delete mode 100644 docs/data-sources/hybrid_deployment_agents.md create mode 100644 docs/data-sources/local_processing_agent.md create mode 100644 docs/data-sources/local_processing_agents.md delete mode 100644 templates/data-sources/hybrid_deployment_agent.md.tmpl delete mode 100644 templates/data-sources/hybrid_deployment_agents.md.tmpl create mode 100644 templates/data-sources/local_processing_agent.md.tmpl create mode 100644 templates/data-sources/local_processing_agents.md.tmpl delete mode 100644 templates/guides/version_1.4.0_update_guides.md.tmpl delete mode 100644 templates/resources/hybrid_deployment_agent.md.tmpl create mode 100644 templates/resources/local_processing_agent.md.tmpl diff --git a/docs/data-sources/hybrid_deployment_agent.md b/docs/data-sources/hybrid_deployment_agent.md deleted file mode 100644 index ed3fda11..00000000 --- a/docs/data-sources/hybrid_deployment_agent.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -page_title: "Data Source: fivetran_hybrid_deployment_agents" ---- - -# Data Source: fivetran_hybrid_deployment_agents - -This data source returns a hybrid deployment agent object. - -## Example Usage - -```hcl -data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agent" { - id = "hybrid_deployment_agent_id" -} -``` - - -## Schema - -### Required - -- `id` (String) The unique identifier for the hybrid deployment agent within your account. - -### Read-Only - -- `auth_type` (String) Type of authentification. Possible values `AUTO`,`MANUAL` -- `display_name` (String) The unique name for the hybrid deployment agent. -- `group_id` (String) The unique identifier for the Group within the Fivetran system. -- `registered_at` (String) The timestamp of the time the hybrid deployment agent was created in your account. \ No newline at end of file diff --git a/docs/data-sources/hybrid_deployment_agents.md b/docs/data-sources/hybrid_deployment_agents.md deleted file mode 100644 index e84ec48f..00000000 --- a/docs/data-sources/hybrid_deployment_agents.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -page_title: "Data Source: fivetran_hybrid_deployment_agents" ---- - -# Data Source: fivetran_hybrid_deployment_agents - -This data source returns a list of all hybrid deployment agents within your Fivetran account. - -## Example Usage - -```hcl -data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agents" { -} -``` - - -## Schema - -### Read-Only - -- `items` (Attributes Set) (see [below for nested schema](#nestedatt--items)) - - -### Nested Schema for `items` - -Required: - -- `id` (String) The unique identifier for the hybrid deployment agent within your account. - -Read-Only: - -- `auth_type` (String) Type of authentification. Possible values `AUTO`,`MANUAL` -- `display_name` (String) The unique name for the hybrid deployment agent. -- `group_id` (String) The unique identifier for the Group within the Fivetran system. -- `registered_at` (String) The timestamp of the time the hybrid deployment agent was created in your account. \ No newline at end of file diff --git a/docs/data-sources/local_processing_agent.md b/docs/data-sources/local_processing_agent.md new file mode 100644 index 00000000..ed8d65f4 --- /dev/null +++ b/docs/data-sources/local_processing_agent.md @@ -0,0 +1,38 @@ +--- +page_title: "Data Source: fivetran_local_processing_agent" +--- + +# Data Source: fivetran_local_processing_agent + +This data source returns a local processing agent object. + +## Example Usage + +```hcl +data "fivetran_local_processing_agent" "local_processing_agent" { + id = "local_processing_agent_id" +} +``` + + +## Schema + +### Required + +- `id` (String) The unique identifier for the local processing agent within your account. + +### Read-Only + +- `display_name` (String) The unique name for the local processing agent. +- `group_id` (String) The unique identifier for the Group within the Fivetran system. +- `registered_at` (String) The timestamp of the time the local processing agent was created in your account. +- `usage` (Attributes Set) (see [below for nested schema](#nestedatt--usage)) + + +### Nested Schema for `usage` + +Read-Only: + +- `connection_id` (String) The unique identifier of the connection associated with the agent. +- `schema` (String) The connection schema name. +- `service` (String) The connection type. \ No newline at end of file diff --git a/docs/data-sources/local_processing_agents.md b/docs/data-sources/local_processing_agents.md new file mode 100644 index 00000000..2d0acf04 --- /dev/null +++ b/docs/data-sources/local_processing_agents.md @@ -0,0 +1,44 @@ +--- +page_title: "Data Source: fivetran_local_processing_agents" +--- + +# Data Source: fivetran_local_processing_agents + +This data source returns a list of all local processing agents within your Fivetran account. + +## Example Usage + +```hcl +data "fivetran_local_processing_agents" "local_processing_agents" { +} +``` + + +## Schema + +### Read-Only + +- `items` (Attributes Set) (see [below for nested schema](#nestedatt--items)) + + +### Nested Schema for `items` + +Required: + +- `id` (String) The unique identifier for the local processing agent within your account. + +Read-Only: + +- `display_name` (String) The unique name for the local processing agent. +- `group_id` (String) The unique identifier for the Group within the Fivetran system. +- `registered_at` (String) The timestamp of the time the local processing agent was created in your account. +- `usage` (Attributes Set) (see [below for nested schema](#nestedatt--items--usage)) + + +### Nested Schema for `items.usage` + +Read-Only: + +- `connection_id` (String) The unique identifier of the connection associated with the agent. +- `schema` (String) The connection schema name. +- `service` (String) The connection type. \ No newline at end of file diff --git a/templates/data-sources/hybrid_deployment_agent.md.tmpl b/templates/data-sources/hybrid_deployment_agent.md.tmpl deleted file mode 100644 index 8ee13508..00000000 --- a/templates/data-sources/hybrid_deployment_agent.md.tmpl +++ /dev/null @@ -1,17 +0,0 @@ ---- -page_title: "Data Source: fivetran_hybrid_deployment_agents" ---- - -# Data Source: fivetran_hybrid_deployment_agents - -This data source returns a hybrid deployment agent object. - -## Example Usage - -```hcl -data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agent" { - id = "hybrid_deployment_agent_id" -} -``` - -{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/hybrid_deployment_agents.md.tmpl b/templates/data-sources/hybrid_deployment_agents.md.tmpl deleted file mode 100644 index 7294d850..00000000 --- a/templates/data-sources/hybrid_deployment_agents.md.tmpl +++ /dev/null @@ -1,16 +0,0 @@ ---- -page_title: "Data Source: fivetran_hybrid_deployment_agents" ---- - -# Data Source: fivetran_hybrid_deployment_agents - -This data source returns a list of all hybrid deployment agents within your Fivetran account. - -## Example Usage - -```hcl -data "fivetran_hybrid_deployment_agents" "hybrid_deployment_agents" { -} -``` - -{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/local_processing_agent.md.tmpl b/templates/data-sources/local_processing_agent.md.tmpl new file mode 100644 index 00000000..d7c96016 --- /dev/null +++ b/templates/data-sources/local_processing_agent.md.tmpl @@ -0,0 +1,17 @@ +--- +page_title: "Data Source: fivetran_local_processing_agent" +--- + +# Data Source: fivetran_local_processing_agent + +This data source returns a local processing agent object. + +## Example Usage + +```hcl +data "fivetran_local_processing_agent" "local_processing_agent" { + id = "local_processing_agent_id" +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/local_processing_agents.md.tmpl b/templates/data-sources/local_processing_agents.md.tmpl new file mode 100644 index 00000000..59658a16 --- /dev/null +++ b/templates/data-sources/local_processing_agents.md.tmpl @@ -0,0 +1,16 @@ +--- +page_title: "Data Source: fivetran_local_processing_agents" +--- + +# Data Source: fivetran_local_processing_agents + +This data source returns a list of all local processing agents within your Fivetran account. + +## Example Usage + +```hcl +data "fivetran_local_processing_agents" "local_processing_agents" { +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/guides/version_1.4.0_update_guides.md.tmpl b/templates/guides/version_1.4.0_update_guides.md.tmpl deleted file mode 100644 index 46babea8..00000000 --- a/templates/guides/version_1.4.0_update_guides.md.tmpl +++ /dev/null @@ -1,64 +0,0 @@ ----- -page_title: "Version Update 1.4.0" -subcategory: "Upgrade Guides" ---- - -# Version 1.4.0 - -## What's new in 1.4.0 - -In version `1.4.0` of Fivetran Terraform provider, resource `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent` - -## Migration guide - -### Provider - -Update your provider configuration in the following way: - -Previous configuration: - -```hcl -required_providers { - fivetran = { - version = "~> 1.3.0" - source = "fivetran/fivetran" - } - } -``` - -Updated configuration: - -```hcl -required_providers { - fivetran = { - version = ">= 1.4.0" - source = "fivetran/fivetran" - } - } -``` - -### Resource `fivetran_hybrid_deployment_agent` - -Update all your connector schema config resources (`fivetran_local_processing_agent`): - -Previous configuration: - -```hcl -resource "fivetran_local_processing_agent" "test_agent" { -} -``` - -Updated configuration: - -```hcl -resource "fivetran_hybrid_deployment_agent" "test_agent" { -} -``` - -### Update terraform state - -Once all configurations have been updated, run: - -``` -terraform init -upgrade -``` \ No newline at end of file diff --git a/templates/resources/hybrid_deployment_agent.md.tmpl b/templates/resources/hybrid_deployment_agent.md.tmpl deleted file mode 100644 index aa914962..00000000 --- a/templates/resources/hybrid_deployment_agent.md.tmpl +++ /dev/null @@ -1,21 +0,0 @@ ---- -page_title: "Resource: fivetran_hybrid_deployment_agent" ---- - -# Resource: fivetran_hybrid_deployment_agent - -This resource allows you to create, update, and delete hybrid deployment agents. - -## Example Usage - -```hcl -resource "fivetran_hybrid_deployment_agent" "hybrid_deployment_agent" { - provider = fivetran-provider - - display_name = "display_name" - group_id = "group_id" - auth_type = "AUTO" -} -``` - -{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/resources/local_processing_agent.md.tmpl b/templates/resources/local_processing_agent.md.tmpl new file mode 100644 index 00000000..db3137ed --- /dev/null +++ b/templates/resources/local_processing_agent.md.tmpl @@ -0,0 +1,20 @@ +--- +page_title: "Resource: fivetran_local_processing_agent" +--- + +# Resource: fivetran_local_processing_agent + +This resource allows you to create, update, and delete local processing agents. + +## Example Usage + +```hcl +resource "fivetran_local_processing_agent" "test_lpa" { + provider = fivetran-provider + + display_name = "display_name" + group_id = "group_id" +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file From 8995ccc49fd1ce00952be4272d88a873e790bc03 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 12:40:59 +0100 Subject: [PATCH 03/21] revert hda --- docs/guides/version_1.4.0_update_guides.md | 64 --------- docs/resources/hybrid_deployment_agent.md | 41 ------ docs/resources/local_processing_agent.md | 51 +++++++ ...ybrid_deployment_agent_datasource_model.go | 36 ----- .../hybrid_deployment_agent_resource_model.go | 51 ------- .../core/model/hybrid_deployment_agents.go | 41 ------ ...ent_agent.go => local_processing_agent.go} | 11 +- ...local_processing_agent_datasource_model.go | 65 +++++++++ .../local_processing_agent_resource_model.go | 71 ++++++++++ .../core/model/local_processing_agents.go | 65 +++++++++ ...ent_agent.go => local_processing_agent.go} | 78 +++++++---- .../hybrid_deployment_agent_test.go | 87 ------------ .../hybrid_deployment_agents_test.go | 111 ---------------- ...ent_agent.go => local_processing_agent.go} | 22 ++-- .../local_processing_agent_test.go | 93 +++++++++++++ ...t_agents.go => local_processing_agents.go} | 30 ++--- .../local_processing_agents_test.go | 124 ++++++++++++++++++ .../resources/hybrid_deployment_agent_test.go | 95 -------------- ...ent_agent.go => local_processing_agent.go} | 52 ++++---- .../resources/local_processing_agent_test.go | 95 ++++++++++++++ ...source_hybrid_deployment_agent_e2e_test.go | 73 ----------- ...esource_local_processing_agent_e2e_test.go | 73 +++++++++++ 22 files changed, 752 insertions(+), 677 deletions(-) delete mode 100644 docs/guides/version_1.4.0_update_guides.md delete mode 100644 docs/resources/hybrid_deployment_agent.md create mode 100644 docs/resources/local_processing_agent.md delete mode 100644 fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go delete mode 100644 fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go delete mode 100644 fivetran/framework/core/model/hybrid_deployment_agents.go rename fivetran/framework/core/model/{hybrid_deployment_agent.go => local_processing_agent.go} (57%) create mode 100644 fivetran/framework/core/model/local_processing_agent_datasource_model.go create mode 100644 fivetran/framework/core/model/local_processing_agent_resource_model.go create mode 100644 fivetran/framework/core/model/local_processing_agents.go rename fivetran/framework/core/schema/{hybrid_deployment_agent.go => local_processing_agent.go} (50%) delete mode 100644 fivetran/framework/datasources/hybrid_deployment_agent_test.go delete mode 100644 fivetran/framework/datasources/hybrid_deployment_agents_test.go rename fivetran/framework/datasources/{hybrid_deployment_agent.go => local_processing_agent.go} (54%) create mode 100644 fivetran/framework/datasources/local_processing_agent_test.go rename fivetran/framework/datasources/{hybrid_deployment_agents.go => local_processing_agents.go} (57%) create mode 100644 fivetran/framework/datasources/local_processing_agents_test.go delete mode 100644 fivetran/framework/resources/hybrid_deployment_agent_test.go rename fivetran/framework/resources/{hybrid_deployment_agent.go => local_processing_agent.go} (59%) create mode 100644 fivetran/framework/resources/local_processing_agent_test.go delete mode 100644 fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go create mode 100644 fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go diff --git a/docs/guides/version_1.4.0_update_guides.md b/docs/guides/version_1.4.0_update_guides.md deleted file mode 100644 index 46babea8..00000000 --- a/docs/guides/version_1.4.0_update_guides.md +++ /dev/null @@ -1,64 +0,0 @@ ----- -page_title: "Version Update 1.4.0" -subcategory: "Upgrade Guides" ---- - -# Version 1.4.0 - -## What's new in 1.4.0 - -In version `1.4.0` of Fivetran Terraform provider, resource `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent` - -## Migration guide - -### Provider - -Update your provider configuration in the following way: - -Previous configuration: - -```hcl -required_providers { - fivetran = { - version = "~> 1.3.0" - source = "fivetran/fivetran" - } - } -``` - -Updated configuration: - -```hcl -required_providers { - fivetran = { - version = ">= 1.4.0" - source = "fivetran/fivetran" - } - } -``` - -### Resource `fivetran_hybrid_deployment_agent` - -Update all your connector schema config resources (`fivetran_local_processing_agent`): - -Previous configuration: - -```hcl -resource "fivetran_local_processing_agent" "test_agent" { -} -``` - -Updated configuration: - -```hcl -resource "fivetran_hybrid_deployment_agent" "test_agent" { -} -``` - -### Update terraform state - -Once all configurations have been updated, run: - -``` -terraform init -upgrade -``` \ No newline at end of file diff --git a/docs/resources/hybrid_deployment_agent.md b/docs/resources/hybrid_deployment_agent.md deleted file mode 100644 index 2b4ea831..00000000 --- a/docs/resources/hybrid_deployment_agent.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -page_title: "Resource: fivetran_hybrid_deployment_agent" ---- - -# Resource: fivetran_hybrid_deployment_agent - -This resource allows you to create, update, and delete hybrid deployment agents. - -## Example Usage - -```hcl -resource "fivetran_hybrid_deployment_agent" "hybrid_deployment_agent" { - provider = fivetran-provider - - display_name = "display_name" - group_id = "group_id" - auth_type = "AUTO" -} -``` - - -## Schema - -### Required - -- `auth_type` (String) Type of authentification. Possible values `AUTO`,`MANUAL` -- `display_name` (String) The unique name for the hybrid deployment agent. -- `group_id` (String) The unique identifier for the Group within the Fivetran system. - -### Optional - -- `authentication_counter` (Number) Determines whether re-authentication needs to be performed. - -### Read-Only - -- `auth_json` (String) Base64-encoded content of the auth.json file. -- `config_json` (String) Base64-encoded content of the config.json file. -- `docker_compose_yaml` (String) Base64-encoded content of the compose file for the chosen containerization type. -- `id` (String) The unique identifier for the hybrid deployment agent within your account. -- `registered_at` (String) The timestamp of the time the hybrid deployment agent was created in your account. -- `token` (String) Base64 encoded content of token. \ No newline at end of file diff --git a/docs/resources/local_processing_agent.md b/docs/resources/local_processing_agent.md new file mode 100644 index 00000000..50d33ace --- /dev/null +++ b/docs/resources/local_processing_agent.md @@ -0,0 +1,51 @@ +--- +page_title: "Resource: fivetran_local_processing_agent" +--- + +# Resource: fivetran_local_processing_agent + +This resource allows you to create, update, and delete local processing agents. + +## Example Usage + +```hcl +resource "fivetran_local_processing_agent" "test_lpa" { + provider = fivetran-provider + + display_name = "display_name" + group_id = "group_id" +} +``` + + +## Schema + +### Required + +- `display_name` (String) The unique name for the local processing agent. +- `group_id` (String) The unique identifier for the Group within the Fivetran system. + +### Optional + +- `authentication_counter` (Number) Determines whether re-authentication needs to be performed. + +### Read-Only + +- `auth_json` (String) Base64-encoded content of the auth.json file. +- `config_json` (String) Base64-encoded content of the config.json file. +- `docker_compose_yaml` (String) Base64-encoded content of the compose file for the chosen containerization type. +- `id` (String) The unique identifier for the local processing agent within your account. +- `registered_at` (String) The timestamp of the time the local processing agent was created in your account. +- `usage` (Attributes Set) (see [below for nested schema](#nestedatt--usage)) + + +### Nested Schema for `usage` + +Required: + +- `schema` (String) The connection schema name. +- `service` (String) The connection type. + +Read-Only: + +- `connection_id` (String) The unique identifier of the connection associated with the agent. \ No newline at end of file diff --git a/fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go b/fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go deleted file mode 100644 index d2ded455..00000000 --- a/fivetran/framework/core/model/hybrid_deployment_agent_datasource_model.go +++ /dev/null @@ -1,36 +0,0 @@ -package model - -import ( - "github.com/fivetran/go-fivetran/hybrid_deployment_agent" - "github.com/hashicorp/terraform-plugin-framework/types" -) - -type HybridDeploymentAgentDatasourceModel struct { - Id types.String `tfsdk:"id"` - DisplayName types.String `tfsdk:"display_name"` - GroupId types.String `tfsdk:"group_id"` - RegisteredAt types.String `tfsdk:"registered_at"` -} - -var _ hybridDeploymentAgentModel = &HybridDeploymentAgentDatasourceModel{} - -func (d *HybridDeploymentAgentDatasourceModel) SetId(value string) { - d.Id = types.StringValue(value) -} -func (d *HybridDeploymentAgentDatasourceModel) SetGroupId(value string) { - d.GroupId = types.StringValue(value) -} -func (d *HybridDeploymentAgentDatasourceModel) SetDisplayName(value string) { - d.DisplayName = types.StringValue(value) -} -func (d *HybridDeploymentAgentDatasourceModel) SetRegisteredAt(value string) { - d.RegisteredAt = types.StringValue(value) -} -func (d *HybridDeploymentAgentDatasourceModel) SetConfigJson(value string) {} -func (d *HybridDeploymentAgentDatasourceModel) SetAuthJson(value string) {} -func (d *HybridDeploymentAgentDatasourceModel) SetDockerComposeYaml(value string) {} - -func (d *HybridDeploymentAgentDatasourceModel) ReadFromResponse(resp hybriddeploymentagent.HybridDeploymentAgentDetailsResponse) { - var model hybridDeploymentAgentModel = d - readHybridDeploymentAgentFromResponse(model, resp) -} \ No newline at end of file diff --git a/fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go b/fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go deleted file mode 100644 index 52471db5..00000000 --- a/fivetran/framework/core/model/hybrid_deployment_agent_resource_model.go +++ /dev/null @@ -1,51 +0,0 @@ -package model - -import ( - "github.com/fivetran/go-fivetran/hybrid_deployment_agent" - "github.com/hashicorp/terraform-plugin-framework/types" -) - -type HybridDeploymentAgentResourceModel struct { - Id types.String `tfsdk:"id"` - DisplayName types.String `tfsdk:"display_name"` - GroupId types.String `tfsdk:"group_id"` - RegisteredAt types.String `tfsdk:"registered_at"` - ConfigJson types.String `tfsdk:"config_json"` - AuthJson types.String `tfsdk:"auth_json"` - DockerComposeYaml types.String `tfsdk:"docker_compose_yaml"` - AuthenticationCounter types.Int64 `tfsdk:"authentication_counter"` -} - -var _ hybridDeploymentAgentModel = &HybridDeploymentAgentResourceModel{} - -func (d *HybridDeploymentAgentResourceModel) SetId(value string) { - d.Id = types.StringValue(value) -} -func (d *HybridDeploymentAgentResourceModel) SetGroupId(value string) { - d.GroupId = types.StringValue(value) -} -func (d *HybridDeploymentAgentResourceModel) SetDisplayName(value string) { - d.DisplayName = types.StringValue(value) -} -func (d *HybridDeploymentAgentResourceModel) SetRegisteredAt(value string) { - d.RegisteredAt = types.StringValue(value) -} -func (d *HybridDeploymentAgentResourceModel) SetConfigJson(value string) { - d.ConfigJson = types.StringValue(value) -} -func (d *HybridDeploymentAgentResourceModel) SetAuthJson(value string) { - d.AuthJson = types.StringValue(value) -} -func (d *HybridDeploymentAgentResourceModel) SetDockerComposeYaml(value string) { - d.DockerComposeYaml = types.StringValue(value) -} -func (d *HybridDeploymentAgentResourceModel) ReadFromCreateResponse(resp hybriddeploymentagent.HybridDeploymentAgentCreateResponse) { - var model hybridDeploymentAgentModel = d - readHybridDeploymentAgentFromCreateResponse(model, resp) - d.AuthenticationCounter = types.Int64Value(d.AuthenticationCounter.ValueInt64() + 1) -} - -func (d *HybridDeploymentAgentResourceModel) ReadFromResponse(resp hybriddeploymentagent.HybridDeploymentAgentDetailsResponse) { - var model hybridDeploymentAgentModel = d - readHybridDeploymentAgentFromResponse(model, resp) -} \ No newline at end of file diff --git a/fivetran/framework/core/model/hybrid_deployment_agents.go b/fivetran/framework/core/model/hybrid_deployment_agents.go deleted file mode 100644 index 2cffbdb6..00000000 --- a/fivetran/framework/core/model/hybrid_deployment_agents.go +++ /dev/null @@ -1,41 +0,0 @@ -package model - -import ( - "context" - - "github.com/fivetran/go-fivetran/hybrid_deployment_agent" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/attr" -) - -type HybridDeploymentAgents struct { - Items types.Set `tfsdk:"items"` -} - -func (d *HybridDeploymentAgents) ReadFromResponse(ctx context.Context, resp hybriddeploymentagent.HybridDeploymentAgentListResponse) { - elementType := map[string]attr.Type{ - "id": types.StringType, - "display_name": types.StringType, - "group_id": types.StringType, - "registered_at": types.StringType, - } - - if resp.Data.Items == nil { - d.Items = types.SetNull(types.ObjectType{AttrTypes: elementType}) - } - - items := []attr.Value{} - - for _, v := range resp.Data.Items { - item := map[string]attr.Value{} - item["id"] = types.StringValue(v.Id) - item["display_name"] = types.StringValue(v.DisplayName) - item["group_id"] = types.StringValue(v.GroupId) - item["registered_at"] = types.StringValue(v.RegisteredAt) - - objectValue, _ := types.ObjectValue(elementType, item) - items = append(items, objectValue) - } - - d.Items, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) -} \ No newline at end of file diff --git a/fivetran/framework/core/model/hybrid_deployment_agent.go b/fivetran/framework/core/model/local_processing_agent.go similarity index 57% rename from fivetran/framework/core/model/hybrid_deployment_agent.go rename to fivetran/framework/core/model/local_processing_agent.go index 4abbf7b6..1acbce32 100644 --- a/fivetran/framework/core/model/hybrid_deployment_agent.go +++ b/fivetran/framework/core/model/local_processing_agent.go @@ -1,10 +1,10 @@ package model import ( - "github.com/fivetran/go-fivetran/hybrid_deployment_agent" + "github.com/fivetran/go-fivetran/local_processing_agent" ) -type hybridDeploymentAgentModel interface { +type localProcessingAgentModel interface { SetId(string) SetDisplayName(string) SetGroupId(string) @@ -12,16 +12,18 @@ type hybridDeploymentAgentModel interface { SetConfigJson(string) SetAuthJson(string) SetDockerComposeYaml(string) + SetUsage([]localprocessingagent.LocalProcessingAgentUsageDetails) } -func readHybridDeploymentAgentFromResponse(d hybridDeploymentAgentModel, resp hybriddeploymentagent.HybridDeploymentAgentDetailsResponse) { +func readLocalProcessingAgentFromResponse(d localProcessingAgentModel, resp localprocessingagent.LocalProcessingAgentDetailsResponse) { d.SetId(resp.Data.Id) d.SetDisplayName(resp.Data.DisplayName) d.SetGroupId(resp.Data.GroupId) d.SetRegisteredAt(resp.Data.RegisteredAt) + d.SetUsage(resp.Data.Usage) } -func readHybridDeploymentAgentFromCreateResponse(d hybridDeploymentAgentModel, resp hybriddeploymentagent.HybridDeploymentAgentCreateResponse) { +func readLocalProcessingAgentFromCreateResponse(d localProcessingAgentModel, resp localprocessingagent.LocalProcessingAgentCreateResponse) { d.SetId(resp.Data.Id) d.SetDisplayName(resp.Data.DisplayName) d.SetGroupId(resp.Data.GroupId) @@ -29,4 +31,5 @@ func readHybridDeploymentAgentFromCreateResponse(d hybridDeploymentAgentModel, r d.SetConfigJson(resp.Data.Files.ConfigJson) d.SetAuthJson(resp.Data.Files.AuthJson) d.SetDockerComposeYaml(resp.Data.Files.DockerComposeYaml) + d.SetUsage(nil) } \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agent_datasource_model.go b/fivetran/framework/core/model/local_processing_agent_datasource_model.go new file mode 100644 index 00000000..83273d94 --- /dev/null +++ b/fivetran/framework/core/model/local_processing_agent_datasource_model.go @@ -0,0 +1,65 @@ +package model + +import ( + "github.com/fivetran/go-fivetran/local_processing_agent" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/attr" +) + +type LocalProcessingAgentDatasourceModel struct { + Id types.String `tfsdk:"id"` + DisplayName types.String `tfsdk:"display_name"` + GroupId types.String `tfsdk:"group_id"` + RegisteredAt types.String `tfsdk:"registered_at"` + Usage types.Set `tfsdk:"usage"` +} + +var ( + elementType = map[string]attr.Type{ + "connection_id": types.StringType, + "schema": types.StringType, + "service": types.StringType, + } +) + +var _ localProcessingAgentModel = &LocalProcessingAgentDatasourceModel{} + +func (d *LocalProcessingAgentDatasourceModel) SetId(value string) { + d.Id = types.StringValue(value) +} +func (d *LocalProcessingAgentDatasourceModel) SetGroupId(value string) { + d.GroupId = types.StringValue(value) +} +func (d *LocalProcessingAgentDatasourceModel) SetDisplayName(value string) { + d.DisplayName = types.StringValue(value) +} +func (d *LocalProcessingAgentDatasourceModel) SetRegisteredAt(value string) { + d.RegisteredAt = types.StringValue(value) +} +func (d *LocalProcessingAgentDatasourceModel) SetUsage(value []localprocessingagent.LocalProcessingAgentUsageDetails) { + if value == nil { + d.Usage = types.SetNull(types.ObjectType{AttrTypes: elementType}) + } + + items := []attr.Value{} + for _, v := range value { + item := map[string]attr.Value{} + item["connection_id"] = types.StringValue(v.ConnectionId) + item["schema"] = types.StringValue(v.Schema) + item["service"] = types.StringValue(v.Service) + + objectValue, _ := types.ObjectValue(elementType, item) + items = append(items, objectValue) + } + + d.Usage, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) +} + +func (d *LocalProcessingAgentDatasourceModel) SetConfigJson(value string) {} +func (d *LocalProcessingAgentDatasourceModel) SetAuthJson(value string) {} +func (d *LocalProcessingAgentDatasourceModel) SetDockerComposeYaml(value string) {} + +func (d *LocalProcessingAgentDatasourceModel) ReadFromResponse(resp localprocessingagent.LocalProcessingAgentDetailsResponse) { + var model localProcessingAgentModel = d + readLocalProcessingAgentFromResponse(model, resp) +} \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agent_resource_model.go b/fivetran/framework/core/model/local_processing_agent_resource_model.go new file mode 100644 index 00000000..550e0999 --- /dev/null +++ b/fivetran/framework/core/model/local_processing_agent_resource_model.go @@ -0,0 +1,71 @@ +package model + +import ( + "github.com/fivetran/go-fivetran/local_processing_agent" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/attr" +) + +type LocalProcessingAgentResourceModel struct { + Id types.String `tfsdk:"id"` + DisplayName types.String `tfsdk:"display_name"` + GroupId types.String `tfsdk:"group_id"` + RegisteredAt types.String `tfsdk:"registered_at"` + ConfigJson types.String `tfsdk:"config_json"` + AuthJson types.String `tfsdk:"auth_json"` + DockerComposeYaml types.String `tfsdk:"docker_compose_yaml"` + AuthenticationCounter types.Int64 `tfsdk:"authentication_counter"` + Usage types.Set `tfsdk:"usage"` +} + +var _ localProcessingAgentModel = &LocalProcessingAgentResourceModel{} + +func (d *LocalProcessingAgentResourceModel) SetId(value string) { + d.Id = types.StringValue(value) +} +func (d *LocalProcessingAgentResourceModel) SetGroupId(value string) { + d.GroupId = types.StringValue(value) +} +func (d *LocalProcessingAgentResourceModel) SetDisplayName(value string) { + d.DisplayName = types.StringValue(value) +} +func (d *LocalProcessingAgentResourceModel) SetRegisteredAt(value string) { + d.RegisteredAt = types.StringValue(value) +} +func (d *LocalProcessingAgentResourceModel) SetConfigJson(value string) { + d.ConfigJson = types.StringValue(value) +} +func (d *LocalProcessingAgentResourceModel) SetAuthJson(value string) { + d.AuthJson = types.StringValue(value) +} +func (d *LocalProcessingAgentResourceModel) SetDockerComposeYaml(value string) { + d.DockerComposeYaml = types.StringValue(value) +} +func (d *LocalProcessingAgentResourceModel) SetUsage(value []localprocessingagent.LocalProcessingAgentUsageDetails) { + if value == nil { + d.Usage = types.SetNull(types.ObjectType{AttrTypes: elementType}) + } + + items := []attr.Value{} + for _, v := range value { + item := map[string]attr.Value{} + item["connection_id"] = types.StringValue(v.ConnectionId) + item["schema"] = types.StringValue(v.Schema) + item["service"] = types.StringValue(v.Service) + + objectValue, _ := types.ObjectValue(elementType, item) + items = append(items, objectValue) + } + + d.Usage, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) +} +func (d *LocalProcessingAgentResourceModel) ReadFromCreateResponse(resp localprocessingagent.LocalProcessingAgentCreateResponse) { + var model localProcessingAgentModel = d + readLocalProcessingAgentFromCreateResponse(model, resp) + d.AuthenticationCounter = types.Int64Value(d.AuthenticationCounter.ValueInt64() + 1) +} + +func (d *LocalProcessingAgentResourceModel) ReadFromResponse(resp localprocessingagent.LocalProcessingAgentDetailsResponse) { + var model localProcessingAgentModel = d + readLocalProcessingAgentFromResponse(model, resp) +} \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agents.go b/fivetran/framework/core/model/local_processing_agents.go new file mode 100644 index 00000000..20b7a3d7 --- /dev/null +++ b/fivetran/framework/core/model/local_processing_agents.go @@ -0,0 +1,65 @@ +package model + +import ( + "context" + + "github.com/fivetran/go-fivetran/local_processing_agent" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/attr" +) + +type LocalProcessingAgents struct { + Items types.Set `tfsdk:"items"` +} + +func (d *LocalProcessingAgents) ReadFromResponse(ctx context.Context, resp localprocessingagent.LocalProcessingAgentListResponse) { + subSetElementType := map[string]attr.Type{ + "connection_id": types.StringType, + "schema": types.StringType, + "service": types.StringType, + } + + subSetAttrType := types.ObjectType{ + AttrTypes: subSetElementType, + } + + elementType := map[string]attr.Type{ + "id": types.StringType, + "display_name": types.StringType, + "group_id": types.StringType, + "registered_at": types.StringType, + "usage": types.SetType{ElemType: subSetAttrType}, + } + + if resp.Data.Items == nil { + d.Items = types.SetNull(types.ObjectType{AttrTypes: elementType}) + } + + items := []attr.Value{} + + for _, v := range resp.Data.Items { + item := map[string]attr.Value{} + item["id"] = types.StringValue(v.Id) + item["display_name"] = types.StringValue(v.DisplayName) + item["group_id"] = types.StringValue(v.GroupId) + item["registered_at"] = types.StringValue(v.RegisteredAt) + + subItems := []attr.Value{} + for _, sub := range v.Usage { + subItem := map[string]attr.Value{} + subItem["connection_id"] = types.StringValue(sub.ConnectionId) + subItem["schema"] = types.StringValue(sub.Schema) + subItem["service"] = types.StringValue(sub.Service) + + subObjectValue, _ := types.ObjectValue(subSetElementType, subItem) + subItems = append(subItems, subObjectValue) + } + + item["usage"], _ = types.SetValue(subSetAttrType, subItems) + + objectValue, _ := types.ObjectValue(elementType, item) + items = append(items, objectValue) + } + + d.Items, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) +} \ No newline at end of file diff --git a/fivetran/framework/core/schema/hybrid_deployment_agent.go b/fivetran/framework/core/schema/local_processing_agent.go similarity index 50% rename from fivetran/framework/core/schema/hybrid_deployment_agent.go rename to fivetran/framework/core/schema/local_processing_agent.go index df119404..69eb1091 100644 --- a/fivetran/framework/core/schema/hybrid_deployment_agent.go +++ b/fivetran/framework/core/schema/local_processing_agent.go @@ -6,13 +6,13 @@ import ( resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema" ) -func hybridDeploymentAgentAttribute() core.Schema { +func localDataProcessingAgentAttribute() core.Schema { result := core.Schema{ Fields: map[string]core.SchemaField{ "id": { IsId: true, ValueType: core.String, - Description: "The unique identifier for the hybrid deployment agent within your account.", + Description: "The unique identifier for the local processing agent within your account.", }, "group_id": { Required: true, @@ -24,18 +24,12 @@ func hybridDeploymentAgentAttribute() core.Schema { Required: true, ForceNew: true, ValueType: core.String, - Description: "The unique name for the hybrid deployment agent.", - }, - "auth_type": { - Required: true, - ForceNew: true, - ValueType: core.String, - Description: "Type of authentification. Possible values `AUTO`,`MANUAL`", + Description: "The unique name for the local processing agent.", }, "registered_at": { Readonly: true, ValueType: core.String, - Description: "The timestamp of the time the hybrid deployment agent was created in your account.", + Description: "The timestamp of the time the local processing agent was created in your account.", }, "authentication_counter": { ResourceOnly: true, @@ -60,32 +54,72 @@ func hybridDeploymentAgentAttribute() core.Schema { ValueType: core.String, Description: "Base64-encoded content of the compose file for the chosen containerization type.", }, - "token": { - ResourceOnly: true, - Readonly: true, - ValueType: core.String, - Description: "Base64 encoded content of token.", - }, }, } return result } -func HybridDeploymentAgentResource() resourceSchema.Schema { - return resourceSchema.Schema{Attributes: hybridDeploymentAgentAttribute().GetResourceSchema(),} +func localDataProcessingAgentUsageAttribute() core.Schema { + return core.Schema{ + Fields: map[string]core.SchemaField{ + "connection_id": { + Readonly: true, + ValueType: core.String, + Description: "The unique identifier of the connection associated with the agent.", + }, + "schema": { + Required: true, + ValueType: core.String, + Description: "The connection schema name.", + }, + "service": { + Required: true, + ValueType: core.String, + Description: "The connection type.", + }, + }, + } +} + +func localDataProcessingAgentDatasourceSchema() map[string]datasourceSchema.Attribute { + schema := localDataProcessingAgentAttribute().GetDatasourceSchema() + + schema["usage"] = datasourceSchema.SetNestedAttribute{ + Computed: true, + NestedObject: datasourceSchema.NestedAttributeObject{ + Attributes: localDataProcessingAgentUsageAttribute().GetDatasourceSchema(), + }, + } + return schema +} + +func localDataProcessingAgentResourceSchema() map[string]resourceSchema.Attribute { + schema := localDataProcessingAgentAttribute().GetResourceSchema() + + schema["usage"] = resourceSchema.SetNestedAttribute{ + Computed: true, + NestedObject: resourceSchema.NestedAttributeObject{ + Attributes: localDataProcessingAgentUsageAttribute().GetResourceSchema(), + }, + } + return schema +} + +func LocalProcessingAgentResource() resourceSchema.Schema { + return resourceSchema.Schema{Attributes: localDataProcessingAgentResourceSchema(),} } -func HybridDeploymentAgentDatasource() datasourceSchema.Schema { - return datasourceSchema.Schema{Attributes: hybridDeploymentAgentAttribute().GetDatasourceSchema(),} +func LocalProcessingAgentDatasource() datasourceSchema.Schema { + return datasourceSchema.Schema{Attributes: localDataProcessingAgentDatasourceSchema(),} } -func HybridDeploymentAgentsDatasource() datasourceSchema.Schema { +func LocalProcessingAgentsDatasource() datasourceSchema.Schema { return datasourceSchema.Schema{ Attributes: map[string]datasourceSchema.Attribute{ "items": datasourceSchema.SetNestedAttribute{ Computed: true, NestedObject: datasourceSchema.NestedAttributeObject{ - Attributes: hybridDeploymentAgentAttribute().GetDatasourceSchema(), + Attributes: localDataProcessingAgentDatasourceSchema(), }, }, }, diff --git a/fivetran/framework/datasources/hybrid_deployment_agent_test.go b/fivetran/framework/datasources/hybrid_deployment_agent_test.go deleted file mode 100644 index 1ce6d5f6..00000000 --- a/fivetran/framework/datasources/hybrid_deployment_agent_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package datasources_test - -import ( - "net/http" - "testing" - - "github.com/fivetran/go-fivetran/tests/mock" - tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -var ( - hdaDataSourceMockGetHandler *mock.Handler - hdaDataSourceMockData map[string]interface{} -) - -const ( - hdaMappingResponse = ` - { - "id": "lpa_id", - "display_name": "display_name", - "group_id": "group_id", - "registered_at": "registered_at", - "usage": [ - { - "connection_id": "connection_id1", - "schema": "schema1", - "service": "service1" - }, - { - "connection_id": "connection_id2", - "schema": "schema2", - "service": "service2" - } - ] - } - ` -) - -func setupMockClientHybridDeploymentAgentDataSourceConfigMapping(t *testing.T) { - tfmock.MockClient().Reset() - - hdaDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( - func(req *http.Request) (*http.Response, error) { - hdaDataSourceMockData = tfmock.CreateMapFromJsonString(t, hdaMappingResponse) - return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", hdaDataSourceMockData), nil - }, - ) -} - -func TestDataSourceHybridDeploymentAgentMappingMock(t *testing.T) { - step1 := resource.TestStep{ - Config: ` - data "fivetran_hybrid_deployment_agent" "test_lpa" { - provider = fivetran-provider - id = "lpa_id" - }`, - - Check: resource.ComposeAggregateTestCheckFunc( - func(s *terraform.State) error { - tfmock.AssertEqual(t, hdaDataSourceMockGetHandler.Interactions, 1) - tfmock.AssertNotEmpty(t, hdaDataSourceMockData) - return nil - }, - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agent.test_lpa", "display_name", "display_name"), - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agent.test_lpa", "group_id", "group_id"), - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agent.test_lpa", "registered_at", "registered_at"), - ), - } - - resource.Test( - t, - resource.TestCase{ - PreCheck: func() { - setupMockClientHybridDeploymentAgentDataSourceConfigMapping(t) - }, - ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, - CheckDestroy: func(s *terraform.State) error { - return nil - }, - Steps: []resource.TestStep{ - step1, - }, - }, - ) -} diff --git a/fivetran/framework/datasources/hybrid_deployment_agents_test.go b/fivetran/framework/datasources/hybrid_deployment_agents_test.go deleted file mode 100644 index 6ee7b68c..00000000 --- a/fivetran/framework/datasources/hybrid_deployment_agents_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package datasources_test - -import ( - "net/http" - "testing" - - "github.com/fivetran/go-fivetran/tests/mock" - tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -var ( - hybridDeploymentAgentsDataSourceMockGetHandler *mock.Handler - hybridDeploymentAgentsDataSourceMockData map[string]interface{} -) - -const ( - hybridDeploymentAgentsMappingResponse = ` - { - "items": [ - { - "id": "id1", - "display_name": "display_name1", - "group_id": "group_id1", - "registered_at": "registered_at1", - "usage": [ - { - "connection_id": "connection_id11", - "schema": "schema11", - "service": "service11" - }, - { - "connection_id": "connection_id12", - "schema": "schema12", - "service": "service12" - } - ] - }, - { - "id": "id2", - "display_name": "display_name2", - "group_id": "group_id2", - "registered_at": "registered_at2", - "usage": [ - { - "connection_id": "connection_id21", - "schema": "schema21", - "service": "service21" - }, - { - "connection_id": "connection_id22", - "schema": "schema22", - "service": "service22" - } - ] - } - ], - "next_cursor": null - }` -) - -func setupMockClientHybridDeploymentAgentsDataSourceConfigMapping(t *testing.T) { - tfmock.MockClient().Reset() - - hybridDeploymentAgentsDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents").ThenCall( - func(req *http.Request) (*http.Response, error) { - hybridDeploymentAgentsDataSourceMockData = tfmock.CreateMapFromJsonString(t, hybridDeploymentAgentsMappingResponse) - return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", hybridDeploymentAgentsDataSourceMockData), nil - }, - ) -} - -func TestDataSourceHybridDeploymentAgentsMappingMock(t *testing.T) { - step1 := resource.TestStep{ - Config: ` - data "fivetran_hybrid_deployment_agents" "test_lpa" { - provider = fivetran-provider - }`, - - Check: resource.ComposeAggregateTestCheckFunc( - func(s *terraform.State) error { - tfmock.AssertEqual(t, hybridDeploymentAgentsDataSourceMockGetHandler.Interactions, 1) - tfmock.AssertNotEmpty(t, hybridDeploymentAgentsDataSourceMockData) - return nil - }, - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.0.display_name", "display_name1"), - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.0.group_id", "group_id1"), - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.0.registered_at", "registered_at1"), - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.1.display_name", "display_name2"), - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.1.group_id", "group_id2"), - resource.TestCheckResourceAttr("data.fivetran_hybrid_deployment_agents.test_lpa", "items.1.registered_at", "registered_at2"), - ), - } - - resource.Test( - t, - resource.TestCase{ - PreCheck: func() { - setupMockClientHybridDeploymentAgentsDataSourceConfigMapping(t) - }, - ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, - CheckDestroy: func(s *terraform.State) error { - return nil - }, - Steps: []resource.TestStep{ - step1, - }, - }, - ) -} diff --git a/fivetran/framework/datasources/hybrid_deployment_agent.go b/fivetran/framework/datasources/local_processing_agent.go similarity index 54% rename from fivetran/framework/datasources/hybrid_deployment_agent.go rename to fivetran/framework/datasources/local_processing_agent.go index afe282b9..28840514 100644 --- a/fivetran/framework/datasources/hybrid_deployment_agent.go +++ b/fivetran/framework/datasources/local_processing_agent.go @@ -11,26 +11,26 @@ import ( fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" ) -func HybridDeploymentAgent() datasource.DataSource { - return &hybridDeploymentAgent{} +func LocalProcessingAgent() datasource.DataSource { + return &localProcessingAgent{} } // Ensure the implementation satisfies the desired interfaces. -var _ datasource.DataSourceWithConfigure = &hybridDeploymentAgent{} +var _ datasource.DataSourceWithConfigure = &localProcessingAgent{} -type hybridDeploymentAgent struct { +type localProcessingAgent struct { core.ProviderDatasource } -func (d *hybridDeploymentAgent) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = "fivetran_hybrid_deployment_agent" +func (d *localProcessingAgent) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = "fivetran_local_processing_agent" } -func (d *hybridDeploymentAgent) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = fivetranSchema.HybridDeploymentAgentDatasource() +func (d *localProcessingAgent) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = fivetranSchema.LocalProcessingAgentDatasource() } -func (d *hybridDeploymentAgent) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *localProcessingAgent) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { if d.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -40,11 +40,11 @@ func (d *hybridDeploymentAgent) Read(ctx context.Context, req datasource.ReadReq return } - var data model.HybridDeploymentAgentDatasourceModel + var data model.LocalProcessingAgentDatasourceModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - detailsResponse, err := d.GetClient().NewHybridDeploymentAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) + detailsResponse, err := d.GetClient().NewLocalProcessingAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( diff --git a/fivetran/framework/datasources/local_processing_agent_test.go b/fivetran/framework/datasources/local_processing_agent_test.go new file mode 100644 index 00000000..66faa40c --- /dev/null +++ b/fivetran/framework/datasources/local_processing_agent_test.go @@ -0,0 +1,93 @@ +package datasources_test + +import ( + "net/http" + "testing" + + "github.com/fivetran/go-fivetran/tests/mock" + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var ( + lpaDataSourceMockGetHandler *mock.Handler + lpaDataSourceMockData map[string]interface{} +) + +const ( + lpaMappingResponse = ` + { + "id": "lpa_id", + "display_name": "display_name", + "group_id": "group_id", + "registered_at": "registered_at", + "usage": [ + { + "connection_id": "connection_id1", + "schema": "schema1", + "service": "service1" + }, + { + "connection_id": "connection_id2", + "schema": "schema2", + "service": "service2" + } + ] + } + ` +) + +func setupMockClientLocalProcessingAgentDataSourceConfigMapping(t *testing.T) { + tfmock.MockClient().Reset() + + lpaDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents/lpa_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + lpaDataSourceMockData = tfmock.CreateMapFromJsonString(t, lpaMappingResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", lpaDataSourceMockData), nil + }, + ) +} + +func TestDataSourceLocalProcessingAgentMappingMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + data "fivetran_local_processing_agent" "test_lpa" { + provider = fivetran-provider + id = "lpa_id" + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, lpaDataSourceMockGetHandler.Interactions, 1) + tfmock.AssertNotEmpty(t, lpaDataSourceMockData) + return nil + }, + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "display_name", "display_name"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "group_id", "group_id"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "registered_at", "registered_at"), + /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.connection_id", "connection_id1"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.schema", "schema1"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.service", "service1"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.connection_id", "connection_id2"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.schema", "schema2"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.service", "service2"),*/ + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientLocalProcessingAgentDataSourceConfigMapping(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + return nil + }, + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/framework/datasources/hybrid_deployment_agents.go b/fivetran/framework/datasources/local_processing_agents.go similarity index 57% rename from fivetran/framework/datasources/hybrid_deployment_agents.go rename to fivetran/framework/datasources/local_processing_agents.go index 5430c1d0..3b71d769 100644 --- a/fivetran/framework/datasources/hybrid_deployment_agents.go +++ b/fivetran/framework/datasources/local_processing_agents.go @@ -7,31 +7,31 @@ import ( "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core" "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/model" "github.com/hashicorp/terraform-plugin-framework/datasource" - sdk "github.com/fivetran/go-fivetran/hybrid_deployment_agent" + sdk "github.com/fivetran/go-fivetran/local_processing_agent" fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" ) -func HybridDeploymentAgents() datasource.DataSource { - return &hybridDeploymentAgents{} +func LocalProcessingAgents() datasource.DataSource { + return &localProcessingAgents{} } // Ensure the implementation satisfies the desired interfaces. -var _ datasource.DataSourceWithConfigure = &hybridDeploymentAgents{} +var _ datasource.DataSourceWithConfigure = &localProcessingAgents{} -type hybridDeploymentAgents struct { +type localProcessingAgents struct { core.ProviderDatasource } -func (d *hybridDeploymentAgents) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = "fivetran_hybrid_deployment_agents" +func (d *localProcessingAgents) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = "fivetran_local_processing_agents" } -func (d *hybridDeploymentAgents) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = fivetranSchema.HybridDeploymentAgentsDatasource() +func (d *localProcessingAgents) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = fivetranSchema.LocalProcessingAgentsDatasource() } -func (d *hybridDeploymentAgents) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *localProcessingAgents) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { if d.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -41,17 +41,17 @@ func (d *hybridDeploymentAgents) Read(ctx context.Context, req datasource.ReadRe return } - var data model.HybridDeploymentAgents + var data model.LocalProcessingAgents resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) var respNextCursor string - var listResponse sdk.HybridDeploymentAgentListResponse + var listResponse sdk.LocalProcessingAgentListResponse limit := 1000 for { var err error - var tmpResp sdk.HybridDeploymentAgentListResponse - svc := d.GetClient().NewHybridDeploymentAgentList() + var tmpResp sdk.LocalProcessingAgentListResponse + svc := d.GetClient().NewLocalProcessingAgentList() if respNextCursor == "" { tmpResp, err = svc.Limit(limit).Do(ctx) @@ -66,7 +66,7 @@ func (d *hybridDeploymentAgents) Read(ctx context.Context, req datasource.ReadRe "Read error.", fmt.Sprintf("%v; code: %v", err, tmpResp.Code), ) - listResponse = sdk.HybridDeploymentAgentListResponse{} + listResponse = sdk.LocalProcessingAgentListResponse{} } listResponse.Data.Items = append(listResponse.Data.Items, tmpResp.Data.Items...) diff --git a/fivetran/framework/datasources/local_processing_agents_test.go b/fivetran/framework/datasources/local_processing_agents_test.go new file mode 100644 index 00000000..259242d8 --- /dev/null +++ b/fivetran/framework/datasources/local_processing_agents_test.go @@ -0,0 +1,124 @@ +package datasources_test + +import ( + "net/http" + "testing" + + "github.com/fivetran/go-fivetran/tests/mock" + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var ( + localProcessingAgentsDataSourceMockGetHandler *mock.Handler + localProcessingAgentsDataSourceMockData map[string]interface{} +) + +const ( + localProcessingAgentsMappingResponse = ` + { + "items": [ + { + "id": "id1", + "display_name": "display_name1", + "group_id": "group_id1", + "registered_at": "registered_at1", + "usage": [ + { + "connection_id": "connection_id11", + "schema": "schema11", + "service": "service11" + }, + { + "connection_id": "connection_id12", + "schema": "schema12", + "service": "service12" + } + ] + }, + { + "id": "id2", + "display_name": "display_name2", + "group_id": "group_id2", + "registered_at": "registered_at2", + "usage": [ + { + "connection_id": "connection_id21", + "schema": "schema21", + "service": "service21" + }, + { + "connection_id": "connection_id22", + "schema": "schema22", + "service": "service22" + } + ] + } + ], + "next_cursor": null + }` +) + +func setupMockClientLocalProcessingAgentsDataSourceConfigMapping(t *testing.T) { + tfmock.MockClient().Reset() + + localProcessingAgentsDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents").ThenCall( + func(req *http.Request) (*http.Response, error) { + localProcessingAgentsDataSourceMockData = tfmock.CreateMapFromJsonString(t, localProcessingAgentsMappingResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", localProcessingAgentsDataSourceMockData), nil + }, + ) +} + +func TestDataSourceLocalProcessingAgentsMappingMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + data "fivetran_local_processing_agents" "test_lpa" { + provider = fivetran-provider + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, localProcessingAgentsDataSourceMockGetHandler.Interactions, 1) + tfmock.AssertNotEmpty(t, localProcessingAgentsDataSourceMockData) + return nil + }, + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.display_name", "display_name1"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.group_id", "group_id1"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.registered_at", "registered_at1"), + /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.connection_id", "connection_id11"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.schema", "schema11"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.service", "service11"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.connection_id", "connection_id12"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.schema", "schema12"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.service", "service12"),*/ + + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.display_name", "display_name2"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.group_id", "group_id2"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.registered_at", "registered_at2"), + /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.connection_id", "connection_id21"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.schema", "schema21"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.service", "service21"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.connection_id", "connection_id22"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.schema", "schema22"), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.service", "service22"),*/ + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientLocalProcessingAgentsDataSourceConfigMapping(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + return nil + }, + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/framework/resources/hybrid_deployment_agent_test.go b/fivetran/framework/resources/hybrid_deployment_agent_test.go deleted file mode 100644 index e5bc0ef9..00000000 --- a/fivetran/framework/resources/hybrid_deployment_agent_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package resources_test - -import ( - "net/http" - "testing" - - tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" - "github.com/fivetran/go-fivetran/tests/mock" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -var ( - hybridDeploymentAgentPostHandler *mock.Handler - hybridDeploymentAgentDeleteHandler *mock.Handler - hybridDeploymentAgentData map[string]interface{} -) - -func setupMockClientHybridDeploymentAgentResource(t *testing.T) { - tfmock.MockClient().Reset() - hybridDeploymentAgentResponse := - `{ - "id": "lpa_id", - "display_name": "display_name", - "group_id": "group_id", - "registered_at": "registered_at", - "files": { - "config_json": "config_json", - "auth_json": "auth_json", - "docker_compose_yaml": "docker_compose_yaml" - } - }` - - hybridDeploymentAgentPostHandler = tfmock.MockClient().When(http.MethodPost, "/v1/hybrid-deployment-agents").ThenCall( - func(req *http.Request) (*http.Response, error) { - hybridDeploymentAgentData = tfmock.CreateMapFromJsonString(t, hybridDeploymentAgentResponse) - return tfmock.FivetranSuccessResponse(t, req, http.StatusCreated, "Hybrid Deployment Agent has been created", hybridDeploymentAgentData), nil - }, - ) - - tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( - func(req *http.Request) (*http.Response, error) { - return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "", hybridDeploymentAgentData), nil - }, - ) - - hybridDeploymentAgentDeleteHandler = tfmock.MockClient().When(http.MethodDelete, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( - func(req *http.Request) (*http.Response, error) { - return tfmock.FivetranSuccessResponse(t, req, 200, "Hybrid Deployment Agent has been deleted", nil), nil - }, - ) -} - -func TestResourceHybridDeploymentAgentMock(t *testing.T) { - step1 := resource.TestStep{ - Config: ` - resource "fivetran_hybrid_deployment_agent" "test_lpa" { - provider = fivetran-provider - - display_name = "display_name" - group_id = "group_id" - }`, - - Check: resource.ComposeAggregateTestCheckFunc( - func(s *terraform.State) error { - tfmock.AssertEqual(t, hybridDeploymentAgentPostHandler.Interactions, 1) - return nil - }, - resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "display_name", "display_name"), - resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "group_id", "group_id"), - resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "registered_at", "registered_at"), - resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "config_json", "config_json"), - resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "auth_json", "auth_json"), - resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "docker_compose_yaml", "docker_compose_yaml"), - ), - } - - resource.Test( - t, - resource.TestCase{ - PreCheck: func() { - setupMockClientHybridDeploymentAgentResource(t) - }, - ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, - CheckDestroy: func(s *terraform.State) error { - tfmock.AssertEqual(t, hybridDeploymentAgentDeleteHandler.Interactions, 1) - return nil - }, - - Steps: []resource.TestStep{ - step1, - }, - }, - ) -} diff --git a/fivetran/framework/resources/hybrid_deployment_agent.go b/fivetran/framework/resources/local_processing_agent.go similarity index 59% rename from fivetran/framework/resources/hybrid_deployment_agent.go rename to fivetran/framework/resources/local_processing_agent.go index e09604f5..7f5b09db 100644 --- a/fivetran/framework/resources/hybrid_deployment_agent.go +++ b/fivetran/framework/resources/local_processing_agent.go @@ -11,31 +11,31 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" ) -func HybridDeploymentAgent() resource.Resource { - return &hybridDeploymentAgent{} +func LocalProcessingAgent() resource.Resource { + return &localProcessingAgent{} } -type hybridDeploymentAgent struct { +type localProcessingAgent struct { core.ProviderResource } // Ensure the implementation satisfies the desired interfaces. -var _ resource.ResourceWithConfigure = &hybridDeploymentAgent{} -var _ resource.ResourceWithImportState = &hybridDeploymentAgent{} +var _ resource.ResourceWithConfigure = &localProcessingAgent{} +var _ resource.ResourceWithImportState = &localProcessingAgent{} -func (r *hybridDeploymentAgent) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_hybrid_deployment_agent" +func (r *localProcessingAgent) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_local_processing_agent" } -func (r *hybridDeploymentAgent) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = fivetranSchema.HybridDeploymentAgentResource() +func (r *localProcessingAgent) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = fivetranSchema.LocalProcessingAgentResource() } -func (r *hybridDeploymentAgent) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *localProcessingAgent) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } -func (r *hybridDeploymentAgent) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *localProcessingAgent) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -45,7 +45,7 @@ func (r *hybridDeploymentAgent) Create(ctx context.Context, req resource.CreateR return } - var data model.HybridDeploymentAgentResourceModel + var data model.LocalProcessingAgentResourceModel // Read Terraform plan data into the model resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) @@ -54,7 +54,7 @@ func (r *hybridDeploymentAgent) Create(ctx context.Context, req resource.CreateR return } - svc := r.GetClient().NewHybridDeploymentAgentCreate() + svc := r.GetClient().NewLocalProcessingAgentCreate() svc.GroupId(data.GroupId.ValueString()) svc.DisplayName(data.DisplayName.ValueString()) svc.EnvType("DOCKER") @@ -63,7 +63,7 @@ func (r *hybridDeploymentAgent) Create(ctx context.Context, req resource.CreateR createResponse, err := svc.Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Create Hybrid Deployment Agent Resource.", + "Unable to Create Local Processing Agent Resource.", fmt.Sprintf("%v; code: %v; message: %v", err, createResponse.Code, createResponse.Message), ) @@ -75,7 +75,7 @@ func (r *hybridDeploymentAgent) Create(ctx context.Context, req resource.CreateR resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } -func (r *hybridDeploymentAgent) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *localProcessingAgent) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -85,16 +85,16 @@ func (r *hybridDeploymentAgent) Read(ctx context.Context, req resource.ReadReque return } - var data model.HybridDeploymentAgentResourceModel + var data model.LocalProcessingAgentResourceModel // Read Terraform prior state data into the model resp.Diagnostics.Append(req.State.Get(ctx, &data)...) - readResponse, err := r.GetClient().NewHybridDeploymentAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) + readResponse, err := r.GetClient().NewLocalProcessingAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Read Hybrid Deployment Agent Resource.", + "Unable to Read Local Processing Agent Resource.", fmt.Sprintf("%v; code: %v", err, readResponse.Code), ) return @@ -105,7 +105,7 @@ func (r *hybridDeploymentAgent) Read(ctx context.Context, req resource.ReadReque resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } -func (r *hybridDeploymentAgent) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *localProcessingAgent) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -115,17 +115,17 @@ func (r *hybridDeploymentAgent) Update(ctx context.Context, req resource.UpdateR return } - var plan, state model.HybridDeploymentAgentResourceModel + var plan, state model.LocalProcessingAgentResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - svc := r.GetClient().NewHybridDeploymentAgentReAuth().AgentId(state.Id.ValueString()) + svc := r.GetClient().NewLocalProcessingAgentReAuth().AgentId(state.Id.ValueString()) updateResponse, err := svc.Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Update Hybrid Deployment Agent Resource.", + "Unable to Update Local Processing Agent Resource.", fmt.Sprintf("%v; code: %v; message: %v", err, updateResponse.Code, updateResponse.Message), ) return @@ -136,7 +136,7 @@ func (r *hybridDeploymentAgent) Update(ctx context.Context, req resource.UpdateR resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) } -func (r *hybridDeploymentAgent) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *localProcessingAgent) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { if r.GetClient() == nil { resp.Diagnostics.AddError( "Unconfigured Fivetran Client", @@ -146,14 +146,14 @@ func (r *hybridDeploymentAgent) Delete(ctx context.Context, req resource.DeleteR return } - var data model.HybridDeploymentAgentResourceModel + var data model.LocalProcessingAgentResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &data)...) - deleteResponse, err := r.GetClient().NewHybridDeploymentAgentDelete().AgentId(data.Id.ValueString()).Do(ctx) + deleteResponse, err := r.GetClient().NewLocalProcessingAgentDelete().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( - "Unable to Delete Hybrid Deployment Agent Resource.", + "Unable to Delete Local Processing Agent Resource.", fmt.Sprintf("%v; code: %v; message: %v", err, deleteResponse.Code, deleteResponse.Message), ) return diff --git a/fivetran/framework/resources/local_processing_agent_test.go b/fivetran/framework/resources/local_processing_agent_test.go new file mode 100644 index 00000000..97a804bb --- /dev/null +++ b/fivetran/framework/resources/local_processing_agent_test.go @@ -0,0 +1,95 @@ +package resources_test + +import ( + "net/http" + "testing" + + tfmock "github.com/fivetran/terraform-provider-fivetran/fivetran/tests/mock" + "github.com/fivetran/go-fivetran/tests/mock" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +var ( + localProcessingAgentPostHandler *mock.Handler + localProcessingAgentDeleteHandler *mock.Handler + localProcessingAgentData map[string]interface{} +) + +func setupMockClientLocalProcessingAgentResource(t *testing.T) { + tfmock.MockClient().Reset() + localProcessingAgentResponse := + `{ + "id": "lpa_id", + "display_name": "display_name", + "group_id": "group_id", + "registered_at": "registered_at", + "files": { + "config_json": "config_json", + "auth_json": "auth_json", + "docker_compose_yaml": "docker_compose_yaml" + } + }` + + localProcessingAgentPostHandler = tfmock.MockClient().When(http.MethodPost, "/v1/local-processing-agents").ThenCall( + func(req *http.Request) (*http.Response, error) { + localProcessingAgentData = tfmock.CreateMapFromJsonString(t, localProcessingAgentResponse) + return tfmock.FivetranSuccessResponse(t, req, http.StatusCreated, "Local Processing Agent has been created", localProcessingAgentData), nil + }, + ) + + tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents/lpa_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "", localProcessingAgentData), nil + }, + ) + + localProcessingAgentDeleteHandler = tfmock.MockClient().When(http.MethodDelete, "/v1/local-processing-agents/lpa_id").ThenCall( + func(req *http.Request) (*http.Response, error) { + return tfmock.FivetranSuccessResponse(t, req, 200, "Local Processing Agent has been deleted", nil), nil + }, + ) +} + +func TestResourceLocalProcessingAgentMock(t *testing.T) { + step1 := resource.TestStep{ + Config: ` + resource "fivetran_local_processing_agent" "test_lpa" { + provider = fivetran-provider + + display_name = "display_name" + group_id = "group_id" + }`, + + Check: resource.ComposeAggregateTestCheckFunc( + func(s *terraform.State) error { + tfmock.AssertEqual(t, localProcessingAgentPostHandler.Interactions, 1) + return nil + }, + resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "display_name", "display_name"), + resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "group_id", "group_id"), + resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "registered_at", "registered_at"), + resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "config_json", "config_json"), + resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "auth_json", "auth_json"), + resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "docker_compose_yaml", "docker_compose_yaml"), + ), + } + + resource.Test( + t, + resource.TestCase{ + PreCheck: func() { + setupMockClientLocalProcessingAgentResource(t) + }, + ProtoV6ProviderFactories: tfmock.ProtoV6ProviderFactories, + CheckDestroy: func(s *terraform.State) error { + tfmock.AssertEqual(t, localProcessingAgentDeleteHandler.Interactions, 1) + return nil + }, + + Steps: []resource.TestStep{ + step1, + }, + }, + ) +} diff --git a/fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go b/fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go deleted file mode 100644 index 14df6aa2..00000000 --- a/fivetran/tests/e2e/resource_hybrid_deployment_agent_e2e_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package e2e_test - -import ( - "context" - "errors" - "fmt" - "strings" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - -func TestResourceHybridDeploymentAgentE2E(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() {}, - ProtoV6ProviderFactories: ProtoV6ProviderFactories, - CheckDestroy: testFivetranHybridDeploymentAgentResourceDestroy, - Steps: []resource.TestStep{ - { - Config: ` - resource "fivetran_group" "testgroup" { - provider = fivetran-provider - name = "TestResourceHybridDeploymentAgentE2E" - } - - resource "fivetran_hybrid_deployment_agent" "test_lpa" { - provider = fivetran-provider - - display_name = "TestResourceHybridDeploymentAgentE2E" - group_id = fivetran_group.testgroup.id - }`, - Check: resource.ComposeAggregateTestCheckFunc( - testFivetranHybridDeploymentAgentResourceCreate(t, "fivetran_hybrid_deployment_agent.test_lpa"), - resource.TestCheckResourceAttr("fivetran_hybrid_deployment_agent.test_lpa", "display_name", "TestResourceHybridDeploymentAgentE2E"), - ), - }, - }, - }) -} - -func testFivetranHybridDeploymentAgentResourceCreate(t *testing.T, resourceName string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs := GetResource(t, s, resourceName) - - _, err := client.NewHybridDeploymentAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) - if err != nil { - fmt.Println(err) - return err - } - //todo: check response _ fields if needed - return nil - } -} - -func testFivetranHybridDeploymentAgentResourceDestroy(s *terraform.State) error { - for _, rs := range s.RootModule().Resources { - if rs.Type != "fivetran_hybrid_deployment_agent" { - continue - } - - response, err := client.NewHybridDeploymentAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) - if err.Error() != "status code: 404; expected: 200" { - return err - } - if !strings.HasPrefix(response.Code, "NotFound") { - return errors.New("Hybrid Deployment Agent " + rs.Primary.ID + " still exists. Response code: " + response.Code) - } - - } - - return nil -} diff --git a/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go b/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go new file mode 100644 index 00000000..256a75db --- /dev/null +++ b/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go @@ -0,0 +1,73 @@ +package e2e_test + +import ( + "context" + "errors" + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" +) + +func TestResourceLocalProcessingAgentE2E(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() {}, + ProtoV6ProviderFactories: ProtoV6ProviderFactories, + CheckDestroy: testFivetranLocalProcessingAgentResourceDestroy, + Steps: []resource.TestStep{ + { + Config: ` + resource "fivetran_group" "testgroup" { + provider = fivetran-provider + name = "TestResourceLocalProcessingAgentE2E" + } + + resource "fivetran_local_processing_agent" "test_lpa" { + provider = fivetran-provider + + display_name = "TestResourceLocalProcessingAgentE2E" + group_id = fivetran_group.testgroup.id + }`, + Check: resource.ComposeAggregateTestCheckFunc( + testFivetranLocalProcessingAgentResourceCreate(t, "fivetran_local_processing_agent.test_lpa"), + resource.TestCheckResourceAttr("fivetran_local_processing_agent.test_lpa", "display_name", "TestResourceLocalProcessingAgentE2E"), + ), + }, + }, + }) +} + +func testFivetranLocalProcessingAgentResourceCreate(t *testing.T, resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs := GetResource(t, s, resourceName) + + _, err := client.NewLocalProcessingAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) + if err != nil { + fmt.Println(err) + return err + } + //todo: check response _ fields if needed + return nil + } +} + +func testFivetranLocalProcessingAgentResourceDestroy(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "fivetran_local_processing_agent" { + continue + } + + response, err := client.NewLocalProcessingAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) + if err.Error() != "status code: 404; expected: 200" { + return err + } + if !strings.HasPrefix(response.Code, "NotFound") { + return errors.New("Local Processing Agent " + rs.Primary.ID + " still exists. Response code: " + response.Code) + } + + } + + return nil +} From 51dd1f78ab30bfd985004774b69e7bfde478ced9 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 12:42:37 +0100 Subject: [PATCH 04/21] REVERT HDA --- CHANGELOG.md | 7 ------- fivetran/framework/core/core.go | 2 +- go.mod | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90828dce..3140394e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,13 +27,6 @@ Updates to support management of private links: - Datasource `fivetran_destination` updates: - Added field `fivetran_destination.private_link_id`. -## Updated -- Resource `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent`. -- Data source `fivetran_local_processing_agent` renamed to `fivetran_hybrid_deployment_agent`. -- Data source `fivetran_local_processing_agents` renamed to `fivetran_hybrid_deployment_agents`. -- Field `fivetran_connector.local_processing_agent_id` renamed to `fivetran_connector.hybrid_deployment_id`. -- Field `fivetran_destination.local_processing_agent_id` renamed to `fivetran_destination.hybrid_deployment_id`. - ## [1.3.2](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.3.1...v1.3.2) ## Added diff --git a/fivetran/framework/core/core.go b/fivetran/framework/core/core.go index 34f93dde..f7c300d3 100644 --- a/fivetran/framework/core/core.go +++ b/fivetran/framework/core/core.go @@ -13,8 +13,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" datasourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" diff --git a/go.mod b/go.mod index 9853d1ac..6ddb5756 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/fivetran/terraform-provider-fivetran require ( - github.com/fivetran/go-fivetran v1.0.2 + github.com/fivetran/go-fivetran v1.0.1 github.com/hashicorp/terraform-plugin-framework v1.12.0 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 From b4bf47a7190f3ae24d9e4d0c72b18270ec0104cf Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 12:59:27 +0100 Subject: [PATCH 05/21] hda --- fivetran/framework/core/model/connector.go | 464 +++++++++--------- fivetran/framework/core/model/destination.go | 4 +- .../model/destination_datasource_model.go | 65 ++- .../core/model/destination_resource_model.go | 10 +- fivetran/framework/core/schema/connector.go | 5 +- fivetran/framework/core/schema/destination.go | 8 +- fivetran/framework/provider.go | 6 +- 7 files changed, 280 insertions(+), 282 deletions(-) diff --git a/fivetran/framework/core/model/connector.go b/fivetran/framework/core/model/connector.go index bed6e82f..9f83cc39 100644 --- a/fivetran/framework/core/model/connector.go +++ b/fivetran/framework/core/model/connector.go @@ -1,194 +1,194 @@ package model import ( - "fmt" - "strings" - - gfcommon "github.com/fivetran/go-fivetran/common" - "github.com/fivetran/go-fivetran/connectors" - "github.com/fivetran/terraform-provider-fivetran/fivetran/common" - "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "fmt" + "strings" + + gfcommon "github.com/fivetran/go-fivetran/common" + "github.com/fivetran/go-fivetran/connectors" + "github.com/fivetran/terraform-provider-fivetran/fivetran/common" + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type ConnectorDatasourceModel struct { - Id types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - ConnectedBy types.String `tfsdk:"connected_by"` - CreatedAt types.String `tfsdk:"created_at"` - GroupId types.String `tfsdk:"group_id"` - Service types.String `tfsdk:"service"` - - DestinationSchema types.Object `tfsdk:"destination_schema"` - - SucceededAt types.String `tfsdk:"succeeded_at"` - FailedAt types.String `tfsdk:"failed_at"` - ServiceVersion types.String `tfsdk:"service_version"` - SyncFrequency types.Int64 `tfsdk:"sync_frequency"` - ScheduleType types.String `tfsdk:"schedule_type"` - Paused types.Bool `tfsdk:"paused"` - PauseAfterTrial types.Bool `tfsdk:"pause_after_trial"` - DailySyncTime types.String `tfsdk:"daily_sync_time"` - - ProxyAgentId types.String `tfsdk:"proxy_agent_id"` - NetworkingMethod types.String `tfsdk:"networking_method"` - HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` - PrivateLinkId types.String `tfsdk:"private_link_id"` - - Status types.Object `tfsdk:"status"` - - Config types.Object `tfsdk:"config"` + Id types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + ConnectedBy types.String `tfsdk:"connected_by"` + CreatedAt types.String `tfsdk:"created_at"` + GroupId types.String `tfsdk:"group_id"` + Service types.String `tfsdk:"service"` + + DestinationSchema types.Object `tfsdk:"destination_schema"` + + SucceededAt types.String `tfsdk:"succeeded_at"` + FailedAt types.String `tfsdk:"failed_at"` + ServiceVersion types.String `tfsdk:"service_version"` + SyncFrequency types.Int64 `tfsdk:"sync_frequency"` + ScheduleType types.String `tfsdk:"schedule_type"` + Paused types.Bool `tfsdk:"paused"` + PauseAfterTrial types.Bool `tfsdk:"pause_after_trial"` + DailySyncTime types.String `tfsdk:"daily_sync_time"` + + ProxyAgentId types.String `tfsdk:"proxy_agent_id"` + NetworkingMethod types.String `tfsdk:"networking_method"` + LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` + PrivateLinkId types.String `tfsdk:"private_link_id"` + + Status types.Object `tfsdk:"status"` + + Config types.Object `tfsdk:"config"` } var ( - codeMessageAttrTypes = map[string]attr.Type{ - "code": types.StringType, - "message": types.StringType, - } + codeMessageAttrTypes = map[string]attr.Type{ + "code": types.StringType, + "message": types.StringType, + } ) func (d *ConnectorDatasourceModel) ReadFromResponse(resp connectors.DetailsWithCustomConfigNoTestsResponse) { - responseContainer := ConnectorModelContainer{} - responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) - d.ReadFromContainer(responseContainer) - - d.SucceededAt = types.StringValue(resp.Data.SucceededAt.String()) - d.FailedAt = types.StringValue(resp.Data.FailedAt.String()) - d.ServiceVersion = types.StringValue(fmt.Sprintf("%v", *resp.Data.ServiceVersion)) - d.SyncFrequency = types.Int64Value(int64(*resp.Data.SyncFrequency)) - d.ScheduleType = types.StringValue(resp.Data.ScheduleType) - d.Paused = types.BoolValue(*resp.Data.Paused) - d.PauseAfterTrial = types.BoolValue(*resp.Data.PauseAfterTrial) - - if resp.Data.DailySyncTime != "" { - d.DailySyncTime = types.StringValue(resp.Data.DailySyncTime) - } else { - d.DailySyncTime = types.StringNull() - } - - codeMessageAttrType := types.ObjectType{ - AttrTypes: codeMessageAttrTypes, - } - - warns := []attr.Value{} - for _, w := range resp.Data.Status.Warnings { - warns = append(warns, readCommonResponse(w)) - } - tasks := []attr.Value{} - for _, t := range resp.Data.Status.Tasks { - tasks = append(tasks, readCommonResponse(t)) - } - - wsV, _ := types.SetValue(codeMessageAttrType, warns) - tsV, _ := types.SetValue(codeMessageAttrType, tasks) - - status, _ := types.ObjectValue( - map[string]attr.Type{ - "setup_state": types.StringType, - "is_historical_sync": types.BoolType, - "sync_state": types.StringType, - "update_state": types.StringType, - "tasks": types.SetType{ElemType: codeMessageAttrType}, - "warnings": types.SetType{ElemType: codeMessageAttrType}, - }, - map[string]attr.Value{ - "setup_state": types.StringValue(resp.Data.Status.SetupState), - "is_historical_sync": types.BoolPointerValue(resp.Data.Status.IsHistoricalSync), - "sync_state": types.StringValue(resp.Data.Status.SyncState), - "update_state": types.StringValue(resp.Data.Status.UpdateState), - "warnings": wsV, - "tasks": tsV, - }, - ) - d.Status = status + responseContainer := ConnectorModelContainer{} + responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) + d.ReadFromContainer(responseContainer) + + d.SucceededAt = types.StringValue(resp.Data.SucceededAt.String()) + d.FailedAt = types.StringValue(resp.Data.FailedAt.String()) + d.ServiceVersion = types.StringValue(fmt.Sprintf("%v", *resp.Data.ServiceVersion)) + d.SyncFrequency = types.Int64Value(int64(*resp.Data.SyncFrequency)) + d.ScheduleType = types.StringValue(resp.Data.ScheduleType) + d.Paused = types.BoolValue(*resp.Data.Paused) + d.PauseAfterTrial = types.BoolValue(*resp.Data.PauseAfterTrial) + + if resp.Data.DailySyncTime != "" { + d.DailySyncTime = types.StringValue(resp.Data.DailySyncTime) + } else { + d.DailySyncTime = types.StringNull() + } + + codeMessageAttrType := types.ObjectType{ + AttrTypes: codeMessageAttrTypes, + } + + warns := []attr.Value{} + for _, w := range resp.Data.Status.Warnings { + warns = append(warns, readCommonResponse(w)) + } + tasks := []attr.Value{} + for _, t := range resp.Data.Status.Tasks { + tasks = append(tasks, readCommonResponse(t)) + } + + wsV, _ := types.SetValue(codeMessageAttrType, warns) + tsV, _ := types.SetValue(codeMessageAttrType, tasks) + + status, _ := types.ObjectValue( + map[string]attr.Type{ + "setup_state": types.StringType, + "is_historical_sync": types.BoolType, + "sync_state": types.StringType, + "update_state": types.StringType, + "tasks": types.SetType{ElemType: codeMessageAttrType}, + "warnings": types.SetType{ElemType: codeMessageAttrType}, + }, + map[string]attr.Value{ + "setup_state": types.StringValue(resp.Data.Status.SetupState), + "is_historical_sync": types.BoolPointerValue(resp.Data.Status.IsHistoricalSync), + "sync_state": types.StringValue(resp.Data.Status.SyncState), + "update_state": types.StringValue(resp.Data.Status.UpdateState), + "warnings": wsV, + "tasks": tsV, + }, + ) + d.Status = status } func readCommonResponse(r gfcommon.CommonResponse) attr.Value { - result, _ := types.ObjectValue(codeMessageAttrTypes, - map[string]attr.Value{ - "code": types.StringValue(r.Code), - "message": types.StringValue(r.Message), - }) - return result + result, _ := types.ObjectValue(codeMessageAttrTypes, + map[string]attr.Value{ + "code": types.StringValue(r.Code), + "message": types.StringValue(r.Message), + }) + return result } type ConnectorResourceModel struct { - Id types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - ConnectedBy types.String `tfsdk:"connected_by"` - CreatedAt types.String `tfsdk:"created_at"` - GroupId types.String `tfsdk:"group_id"` - Service types.String `tfsdk:"service"` - DestinationSchema types.Object `tfsdk:"destination_schema"` - - ProxyAgentId types.String `tfsdk:"proxy_agent_id"` - NetworkingMethod types.String `tfsdk:"networking_method"` - HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` - PrivateLinkId types.String `tfsdk:"private_link_id"` - - Config types.Object `tfsdk:"config"` - Auth types.Object `tfsdk:"auth"` - Timeouts timeouts.Value `tfsdk:"timeouts"` - - RunSetupTests types.Bool `tfsdk:"run_setup_tests"` - TrustCertificates types.Bool `tfsdk:"trust_certificates"` - TrustFingerprints types.Bool `tfsdk:"trust_fingerprints"` + Id types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + ConnectedBy types.String `tfsdk:"connected_by"` + CreatedAt types.String `tfsdk:"created_at"` + GroupId types.String `tfsdk:"group_id"` + Service types.String `tfsdk:"service"` + DestinationSchema types.Object `tfsdk:"destination_schema"` + + ProxyAgentId types.String `tfsdk:"proxy_agent_id"` + NetworkingMethod types.String `tfsdk:"networking_method"` + LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` + PrivateLinkId types.String `tfsdk:"private_link_id"` + + Config types.Object `tfsdk:"config"` + Auth types.Object `tfsdk:"auth"` + Timeouts timeouts.Value `tfsdk:"timeouts"` + + RunSetupTests types.Bool `tfsdk:"run_setup_tests"` + TrustCertificates types.Bool `tfsdk:"trust_certificates"` + TrustFingerprints types.Bool `tfsdk:"trust_fingerprints"` } func (d *ConnectorResourceModel) ReadFromResponse(resp connectors.DetailsWithCustomConfigNoTestsResponse, forceReadConfig bool) diag.Diagnostics { - responseContainer := ConnectorModelContainer{} - responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) - d.ReadFromContainer(responseContainer, forceReadConfig) - return nil + responseContainer := ConnectorModelContainer{} + responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) + d.ReadFromContainer(responseContainer, forceReadConfig) + return nil } func (d *ConnectorResourceModel) ReadFromCreateResponse(resp connectors.DetailsWithCustomConfigResponse) diag.Diagnostics { - responseContainer := ConnectorModelContainer{} - responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) - d.ReadFromContainer(responseContainer, false) - return nil + responseContainer := ConnectorModelContainer{} + responseContainer.ReadFromResponseData(resp.Data.DetailsResponseDataCommon, resp.Data.Config) + d.ReadFromContainer(responseContainer, false) + return nil } func (d *ConnectorResourceModel) GetConfigMap(nullOnNull bool) (map[string]interface{}, error) { - if d.Config.IsNull() && nullOnNull { - return nil, nil - } - result := getValueFromAttrValue(d.Config, common.GetConfigFieldsMap(), nil, d.Service.ValueString()).(map[string]interface{}) - serviceName := d.Service.ValueString() - serviceFields, err := common.GetFieldsForService(serviceName) - if err != nil { - return result, err - } - allFields := common.GetConfigFieldsMap() - err = patchServiceSpecificFields(result, serviceName, serviceFields, allFields) - return result, err + if d.Config.IsNull() && nullOnNull { + return nil, nil + } + result := getValueFromAttrValue(d.Config, common.GetConfigFieldsMap(), nil, d.Service.ValueString()).(map[string]interface{}) + serviceName := d.Service.ValueString() + serviceFields, err := common.GetFieldsForService(serviceName) + if err != nil { + return result, err + } + allFields := common.GetConfigFieldsMap() + err = patchServiceSpecificFields(result, serviceName, serviceFields, allFields) + return result, err } func (d *ConnectorResourceModel) GetAuthMap(nullOnNull bool) (map[string]interface{}, error) { - if d.Auth.IsNull() && nullOnNull { - return nil, nil - } - serviceName := d.Service.ValueString() - serviceFields := common.GetAuthFieldsForService(serviceName) - allFields := common.GetAuthFieldsMap() - - result := getValueFromAttrValue(d.Auth, allFields, nil, serviceName).(map[string]interface{}) - err := patchServiceSpecificFields(result, serviceName, serviceFields, allFields) - return result, err + if d.Auth.IsNull() && nullOnNull { + return nil, nil + } + serviceName := d.Service.ValueString() + serviceFields := common.GetAuthFieldsForService(serviceName) + allFields := common.GetAuthFieldsMap() + + result := getValueFromAttrValue(d.Auth, allFields, nil, serviceName).(map[string]interface{}) + err := patchServiceSpecificFields(result, serviceName, serviceFields, allFields) + return result, err } func (d *ConnectorResourceModel) GetDestinatonSchemaForConfig() (map[string]interface{}, error) { - if d.DestinationSchema.IsNull() || d.DestinationSchema.IsUnknown() { - return nil, fmt.Errorf("Field `destination_schema` is required.") - } - return getDestinatonSchemaForConfig(d.Service, - d.DestinationSchema.Attributes()["name"], - d.DestinationSchema.Attributes()["table"], - d.DestinationSchema.Attributes()["prefix"], - ) + if d.DestinationSchema.IsNull() || d.DestinationSchema.IsUnknown() { + return nil, fmt.Errorf("Field `destination_schema` is required.") + } + return getDestinatonSchemaForConfig(d.Service, + d.DestinationSchema.Attributes()["name"], + d.DestinationSchema.Attributes()["table"], + d.DestinationSchema.Attributes()["prefix"], + ) } func (d *ConnectorResourceModel) ReadFromContainer(c ConnectorModelContainer, forceReadConfig bool) { @@ -199,17 +199,17 @@ func (d *ConnectorResourceModel) ReadFromContainer(c ConnectorModelContainer, fo d.GroupId = types.StringValue(c.GroupId) d.Service = types.StringValue(c.Service) - if c.HybridDeploymentAgentId != "" { - d.HybridDeploymentAgentId = types.StringValue(c.HybridDeploymentAgentId) + if c.LocalProcessingAgentId != "" { + d.LocalProcessingAgentId = types.StringValue(c.LocalProcessingAgentId) } else { - d.HybridDeploymentAgentId = types.StringNull() + d.LocalProcessingAgentId = types.StringNull() } if c.PrivateLinkId != "" { d.PrivateLinkId = types.StringValue(c.PrivateLinkId) - } else { + } else { d.PrivateLinkId = types.StringNull() - } + } if c.ProxyAgentId != "" { d.ProxyAgentId = types.StringValue(c.ProxyAgentId) @@ -231,18 +231,18 @@ func (d *ConnectorResourceModel) ReadFromContainer(c ConnectorModelContainer, fo } func (d *ConnectorDatasourceModel) ReadFromContainer(c ConnectorModelContainer) { - d.Id = types.StringValue(c.Id) - d.Name = types.StringValue(c.Schema) - d.ConnectedBy = types.StringValue(c.ConnectedBy) - d.CreatedAt = types.StringValue(c.CreatedAt) - d.GroupId = types.StringValue(c.GroupId) - d.Service = types.StringValue(c.Service) + d.Id = types.StringValue(c.Id) + d.Name = types.StringValue(c.Schema) + d.ConnectedBy = types.StringValue(c.ConnectedBy) + d.CreatedAt = types.StringValue(c.CreatedAt) + d.GroupId = types.StringValue(c.GroupId) + d.Service = types.StringValue(c.Service) if c.PrivateLinkId != "" { d.PrivateLinkId = types.StringValue(c.PrivateLinkId) - } else { + } else { d.PrivateLinkId = types.StringNull() - } + } if c.ProxyAgentId != "" { d.ProxyAgentId = types.StringValue(c.ProxyAgentId) @@ -254,42 +254,42 @@ func (d *ConnectorDatasourceModel) ReadFromContainer(c ConnectorModelContainer) d.NetworkingMethod = types.StringValue(c.NetworkingMethod) } - if c.HybridDeploymentAgentId != "" { - d.HybridDeploymentAgentId = types.StringValue(c.HybridDeploymentAgentId) - } else { - d.HybridDeploymentAgentId = types.StringNull() - } + if c.LocalProcessingAgentId != "" { + d.LocalProcessingAgentId = types.StringValue(c.LocalProcessingAgentId) + } else { + d.LocalProcessingAgentId = types.StringNull() + } d.DestinationSchema = getDestinationSchemaValue(c.Service, c.Schema) - d.Config = getValue( - types.ObjectType{AttrTypes: getAttrTypes(common.GetConfigFieldsMap())}, - c.Config, - c.Config, - common.GetConfigFieldsMap(), - nil, - c.Service).(basetypes.ObjectValue) + d.Config = getValue( + types.ObjectType{AttrTypes: getAttrTypes(common.GetConfigFieldsMap())}, + c.Config, + c.Config, + common.GetConfigFieldsMap(), + nil, + c.Service).(basetypes.ObjectValue) } type ConnectorModelContainer struct { - Id string - Name string - ConnectedBy string - CreatedAt string - GroupId string - Service string - Schema string - - ProxyAgentId string - NetworkingMethod string - HybridDeploymentAgentId string + Id string + Name string + ConnectedBy string + CreatedAt string + GroupId string + Service string + Schema string + + ProxyAgentId string + NetworkingMethod string + LocalProcessingAgentId string PrivateLinkId string Config map[string]interface{} - RunSetupTests bool - TrustCertificates bool - TrustFingerprints bool + RunSetupTests bool + TrustCertificates bool + TrustFingerprints bool } func (c *ConnectorModelContainer) ReadFromResponseData(data connectors.DetailsResponseDataCommon, config map[string]interface{}) { @@ -310,13 +310,13 @@ func (c *ConnectorModelContainer) ReadFromResponseData(data connectors.DetailsRe c.NetworkingMethod = data.NetworkingMethod } - if data.HybridDeploymentAgentId != "" { - c.HybridDeploymentAgentId = data.HybridDeploymentAgentId - } + if data.LocalProcessingAgentId != "" { + c.LocalProcessingAgentId = data.LocalProcessingAgentId + } if data.PrivateLinkId != "" { c.PrivateLinkId = data.PrivateLinkId - } + } } func getDestinatonSchemaForConfig(serviceId, nameAttr, tableAttr, prefixAttr attr.Value) (map[string]interface{}, error) { @@ -355,38 +355,38 @@ func getDestinatonSchemaForConfig(serviceId, nameAttr, tableAttr, prefixAttr att } func getDestinationSchemaValue(service, schema string) types.Object { - r, _ := types.ObjectValue( - map[string]attr.Type{ - "name": types.StringType, - "table": types.StringType, - "prefix": types.StringType, - }, - getDestinationSchemaValuesMap(service, schema), - ) - return r + r, _ := types.ObjectValue( + map[string]attr.Type{ + "name": types.StringType, + "table": types.StringType, + "prefix": types.StringType, + }, + getDestinationSchemaValuesMap(service, schema), + ) + return r } func getDestinationSchemaValuesMap(service, schema string) map[string]attr.Value { - if _, ok := common.GetDestinationSchemaFields()[service]; !ok { - panic(fmt.Errorf("unknown connector service: `%v`", service)) - } - - if common.GetDestinationSchemaFields()[service]["schema_prefix"] { - return map[string]attr.Value{ - "name": types.StringNull(), - "table": types.StringNull(), - "prefix": types.StringValue(schema), - } - } else { - result := map[string]attr.Value{ - "table": types.StringNull(), - "prefix": types.StringNull(), - } - s := strings.Split(schema, ".") - result["name"] = types.StringValue(s[0]) - if len(s) > 1 && common.GetDestinationSchemaFields()[service]["table"] { - result["table"] = types.StringValue(s[1]) - } - return result - } + if _, ok := common.GetDestinationSchemaFields()[service]; !ok { + panic(fmt.Errorf("unknown connector service: `%v`", service)) + } + + if common.GetDestinationSchemaFields()[service]["schema_prefix"] { + return map[string]attr.Value{ + "name": types.StringNull(), + "table": types.StringNull(), + "prefix": types.StringValue(schema), + } + } else { + result := map[string]attr.Value{ + "table": types.StringNull(), + "prefix": types.StringNull(), + } + s := strings.Split(schema, ".") + result["name"] = types.StringValue(s[0]) + if len(s) > 1 && common.GetDestinationSchemaFields()[service]["table"] { + result["table"] = types.StringValue(s[1]) + } + return result + } } diff --git a/fivetran/framework/core/model/destination.go b/fivetran/framework/core/model/destination.go index 7a6f966a..a30b5ed0 100644 --- a/fivetran/framework/core/model/destination.go +++ b/fivetran/framework/core/model/destination.go @@ -12,7 +12,7 @@ type destinationModel interface { SetTimeZonOffset(string) SetSetupStatus(string) SetDaylightSavingTimeEnabled(bool) - SetHybridDeploymentAgentId(string) + SetLocalProcessingAgentId(string) SetNetworkingMethod(string) SetPrivateLinkId(string) SetConfig(map[string]interface{}) @@ -26,7 +26,7 @@ func readFromResponse(d destinationModel, resp destinations.DestinationDetailsBa d.SetSetupStatus(resp.SetupStatus) d.SetTimeZonOffset(resp.TimeZoneOffset) d.SetDaylightSavingTimeEnabled(resp.DaylightSavingTimeEnabled) - d.SetHybridDeploymentAgentId(resp.HybridDeploymentAgentId) + d.SetLocalProcessingAgentId(resp.LocalProcessingAgentId) d.SetNetworkingMethod(resp.NetworkingMethod) d.SetPrivateLinkId(resp.PrivateLinkId) d.SetConfig(config) diff --git a/fivetran/framework/core/model/destination_datasource_model.go b/fivetran/framework/core/model/destination_datasource_model.go index ce43cfaa..38c3b473 100644 --- a/fivetran/framework/core/model/destination_datasource_model.go +++ b/fivetran/framework/core/model/destination_datasource_model.go @@ -1,10 +1,10 @@ package model import ( - "github.com/fivetran/go-fivetran/destinations" - "github.com/fivetran/terraform-provider-fivetran/fivetran/common" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/fivetran/go-fivetran/destinations" + "github.com/fivetran/terraform-provider-fivetran/fivetran/common" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type DestinationDatasourceModel struct { @@ -15,34 +15,33 @@ type DestinationDatasourceModel struct { TimeZoneOffset types.String `tfsdk:"time_zone_offset"` SetupStatus types.String `tfsdk:"setup_status"` DaylightSavingTimeEnabled types.Bool `tfsdk:"daylight_saving_time_enabled"` - HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` + LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` NetworkingMethod types.String `tfsdk:"networking_method"` - PrivateLinkId types.String `tfsdk:"private_link_id"` Config types.Object `tfsdk:"config"` } var _ destinationModel = &DestinationDatasourceModel{} func (d *DestinationDatasourceModel) SetId(value string) { - d.Id = types.StringValue(value) + d.Id = types.StringValue(value) } func (d *DestinationDatasourceModel) SetGroupId(value string) { - d.GroupId = types.StringValue(value) + d.GroupId = types.StringValue(value) } func (d *DestinationDatasourceModel) SetService(value string) { - d.Service = types.StringValue(value) + d.Service = types.StringValue(value) } func (d *DestinationDatasourceModel) SetRegion(value string) { - d.Region = types.StringValue(value) + d.Region = types.StringValue(value) } func (d *DestinationDatasourceModel) SetTimeZonOffset(value string) { - d.TimeZoneOffset = types.StringValue(value) + d.TimeZoneOffset = types.StringValue(value) } func (d *DestinationDatasourceModel) SetSetupStatus(value string) { - d.SetupStatus = types.StringValue(value) + d.SetupStatus = types.StringValue(value) } func (d *DestinationDatasourceModel) SetDaylightSavingTimeEnabled(value bool) { - d.DaylightSavingTimeEnabled = types.BoolValue(value) + d.DaylightSavingTimeEnabled = types.BoolValue(value) } func (d *DestinationDatasourceModel) SetPrivateLinkId(value string) { if value != "" { @@ -51,11 +50,11 @@ func (d *DestinationDatasourceModel) SetPrivateLinkId(value string) { d.PrivateLinkId = types.StringNull() } } -func (d *DestinationDatasourceModel) SetHybridDeploymentAgentId(value string) { +func (d *DestinationDatasourceModel) SetLocalProcessingAgentId(value string) { if value != "" { - d.HybridDeploymentAgentId = types.StringValue(value) + d.LocalProcessingAgentId = types.StringValue(value) } else { - d.HybridDeploymentAgentId = types.StringNull() + d.LocalProcessingAgentId = types.StringNull() } } func (d *DestinationDatasourceModel) SetNetworkingMethod(value string) { @@ -64,24 +63,24 @@ func (d *DestinationDatasourceModel) SetNetworkingMethod(value string) { } } func (d *DestinationDatasourceModel) SetConfig(value map[string]interface{}) { - if d.Service.IsNull() || d.Service.IsUnknown() { - panic("Service type is null. Can't handle config without service type.") - } - // WA for inconsistent BQ response - it returns just "location" instead of "data_set_location" - if l, ok := value["location"]; ok { - value["data_set_location"] = l - } - service := d.Service.ValueString() - d.Config = getValue( - types.ObjectType{AttrTypes: getAttrTypes(common.GetDestinationFieldsMap())}, - value, - value, - common.GetDestinationFieldsMap(), - nil, - service).(basetypes.ObjectValue) + if d.Service.IsNull() || d.Service.IsUnknown() { + panic("Service type is null. Can't handle config without service type.") + } + // WA for inconsistent BQ response - it returns just "location" instead of "data_set_location" + if l, ok := value["location"]; ok { + value["data_set_location"] = l + } + service := d.Service.ValueString() + d.Config = getValue( + types.ObjectType{AttrTypes: getAttrTypes(common.GetDestinationFieldsMap())}, + value, + value, + common.GetDestinationFieldsMap(), + nil, + service).(basetypes.ObjectValue) } func (d *DestinationDatasourceModel) ReadFromResponse(resp destinations.DestinationDetailsCustomResponse) { - var model destinationModel = d - readFromResponse(model, resp.Data.DestinationDetailsBase, resp.Data.Config) + var model destinationModel = d + readFromResponse(model, resp.Data.DestinationDetailsBase, resp.Data.Config) } diff --git a/fivetran/framework/core/model/destination_resource_model.go b/fivetran/framework/core/model/destination_resource_model.go index a9738e62..8aa5d896 100644 --- a/fivetran/framework/core/model/destination_resource_model.go +++ b/fivetran/framework/core/model/destination_resource_model.go @@ -18,9 +18,8 @@ type DestinationResourceModel struct { DaylightSavingTimeEnabled types.Bool `tfsdk:"daylight_saving_time_enabled"` Config types.Object `tfsdk:"config"` Timeouts timeouts.Value `tfsdk:"timeouts"` - HybridDeploymentAgentId types.String `tfsdk:"hybrid_deployment_agent_id"` + LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` NetworkingMethod types.String `tfsdk:"networking_method"` - PrivateLinkId types.String `tfsdk:"private_link_id"` RunSetupTests types.Bool `tfsdk:"run_setup_tests"` TrustCertificates types.Bool `tfsdk:"trust_certificates"` @@ -50,12 +49,11 @@ func (d *DestinationResourceModel) SetSetupStatus(value string) { func (d *DestinationResourceModel) SetDaylightSavingTimeEnabled(value bool) { d.DaylightSavingTimeEnabled = types.BoolValue(value) } - -func (d *DestinationResourceModel) SetHybridDeploymentAgentId(value string) { +func (d *DestinationResourceModel) SetLocalProcessingAgentId(value string) { if value != "" { - d.HybridDeploymentAgentId = types.StringValue(value) + d.LocalProcessingAgentId = types.StringValue(value) } else { - d.HybridDeploymentAgentId = types.StringNull() + d.LocalProcessingAgentId = types.StringNull() } } func (d *DestinationResourceModel) SetNetworkingMethod(value string) { diff --git a/fivetran/framework/core/schema/connector.go b/fivetran/framework/core/schema/connector.go index 6b949d63..ad6026f6 100644 --- a/fivetran/framework/core/schema/connector.go +++ b/fivetran/framework/core/schema/connector.go @@ -44,6 +44,7 @@ func ConnectorAttributesSchema() core.Schema { ValueType: core.String, Description: "The connector type id within the Fivetran system.", }, + "run_setup_tests": { ValueType: core.Boolean, Description: "Specifies whether the setup tests should be run automatically. The default value is FALSE.", @@ -108,9 +109,9 @@ func ConnectorAttributesSchema() core.Schema { ValueType: core.StringEnum, Description: "Possible values: Directly, SshTunnel, ProxyAgent.", }, - "hybrid_deployment_agent_id": { + "local_processing_agent_id": { ValueType: core.String, - Description: "The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", + Description: "The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", }, "private_link_id": { ValueType: core.String, diff --git a/fivetran/framework/core/schema/destination.go b/fivetran/framework/core/schema/destination.go index 385b8282..d5e66982 100644 --- a/fivetran/framework/core/schema/destination.go +++ b/fivetran/framework/core/schema/destination.go @@ -60,16 +60,16 @@ func DestinationAttributesSchema() core.Schema { Description: "Destination setup status.", }, "daylight_saving_time_enabled": { - ValueType: core.Boolean, - Description: "Shift my UTC offset with daylight savings time (US Only)", + ValueType: core.Boolean, + Description: "Shift my UTC offset with daylight savings time (US Only)", }, "private_link_id": { ValueType: core.String, Description: "The private link ID.", }, - "hybrid_deployment_agent_id": { + "local_processing_agent_id": { ValueType: core.String, - Description: "The lhybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", + Description: "The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.", }, "networking_method": { ValueType: core.StringEnum, diff --git a/fivetran/framework/provider.go b/fivetran/framework/provider.go index c5c88bdc..d6d018a8 100644 --- a/fivetran/framework/provider.go +++ b/fivetran/framework/provider.go @@ -119,7 +119,7 @@ func (p *fivetranProvider) Resources(ctx context.Context) []func() resource.Reso resources.DbtProject, resources.DbtTransformation, resources.ProxyAgent, - resources.HybridDeploymentAgent, + resources.LocalProcessingAgent, resources.DbtGitProjectConfig, resources.PrivateLink, } @@ -159,8 +159,8 @@ func (p *fivetranProvider) DataSources(ctx context.Context) []func() datasource. datasources.DbtTransformation, datasources.ProxyAgent, datasources.ProxyAgents, - datasources.HybridDeploymentAgent, - datasources.HybridDeploymentAgents, + datasources.LocalProcessingAgent, + datasources.LocalProcessingAgents, datasources.PrivateLink, datasources.PrivateLinks, } From 53b55d63d4e28ee6779df94be3a3156b075611c9 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 13:19:21 +0100 Subject: [PATCH 06/21] hda --- fivetran/framework/resources/connector.go | 8 ++-- .../resources/connector_migrations.go | 5 ++- fivetran/framework/resources/destination.go | 12 +++--- .../resources/destination_migrations.go | 6 ++- fivetran/tests/e2e/fivetran_test.go | 10 ++--- ...e_connector_dynamic_fields_mapping_test.go | 3 +- go.sum | 40 ------------------- 7 files changed, 23 insertions(+), 61 deletions(-) diff --git a/fivetran/framework/resources/connector.go b/fivetran/framework/resources/connector.go index 4ffa5339..840c7642 100644 --- a/fivetran/framework/resources/connector.go +++ b/fivetran/framework/resources/connector.go @@ -158,8 +158,8 @@ func (r *connector) Create(ctx context.Context, req resource.CreateRequest, resp svc.NetworkingMethod(data.NetworkingMethod.ValueString()) } - if data.HybridDeploymentAgentId.ValueString() != "" { - svc.HybridDeploymentAgentId(data.HybridDeploymentAgentId.ValueString()) + if data.LocalProcessingAgentId.ValueString() != "" { + svc.LocalProcessingAgentId(data.LocalProcessingAgentId.ValueString()) } if data.PrivateLinkId.ValueString() != "" { @@ -326,8 +326,8 @@ func (r *connector) Update(ctx context.Context, req resource.UpdateRequest, resp TrustFingerprints(trustFingerprintsPlan). ConnectorID(state.Id.ValueString()) - if plan.HybridDeploymentAgentId.ValueString() != "" { - svc.HybridDeploymentAgentId(plan.HybridDeploymentAgentId.ValueString()) + if plan.LocalProcessingAgentId.ValueString() != "" { + svc.LocalProcessingAgentId(plan.LocalProcessingAgentId.ValueString()) } if plan.PrivateLinkId.ValueString() != "" { diff --git a/fivetran/framework/resources/connector_migrations.go b/fivetran/framework/resources/connector_migrations.go index a2fe091e..dde1180a 100644 --- a/fivetran/framework/resources/connector_migrations.go +++ b/fivetran/framework/resources/connector_migrations.go @@ -47,7 +47,8 @@ func upgradeConnectorState(ctx context.Context, req resource.UpgradeStateRequest "timeouts": rawState["timeouts"], "networking_method": tftypes.NewValue(tftypes.String, nil), "proxy_agent_id": tftypes.NewValue(tftypes.String, nil), - "hybrid_deployment_agent_id": rawState["local_processing_agent_id"], + "local_processing_agent_id": tftypes.NewValue(tftypes.String, nil), + "private_link_id": tftypes.NewValue(tftypes.String, nil), "run_setup_tests": convertStringStateValueToBool("run_setup_tests", rawState["run_setup_tests"], resp.Diagnostics), "trust_fingerprints": convertStringStateValueToBool("trust_fingerprints", rawState["trust_fingerprints"], resp.Diagnostics), @@ -104,7 +105,7 @@ func getConnectorStateModel(version int) tftypes.Type { base["proxy_agent_id"] = tftypes.String base["networking_method"] = tftypes.String base["local_processing_agent_id"] = tftypes.String - base["private_link_id"] = tftypes.String + base["private_link_id"] = tftypes.String base["config"] = tftypes.Object{AttributeTypes: model.GetTfTypes(common.GetConfigFieldsMap(), 3)} base["auth"] = tftypes.Object{AttributeTypes: model.GetTfTypes(common.GetAuthFieldsMap(), 3)} } else { diff --git a/fivetran/framework/resources/destination.go b/fivetran/framework/resources/destination.go index 820847cb..55404a1b 100644 --- a/fivetran/framework/resources/destination.go +++ b/fivetran/framework/resources/destination.go @@ -105,13 +105,13 @@ func (r *destination) Create(ctx context.Context, req resource.CreateRequest, re DaylightSavingTimeEnabled(daylightSavingTimeEnabledPlan). ConfigCustom(&configMap) - if data.HybridDeploymentAgentId.ValueString() != "" { - svc.HybridDeploymentAgentId(data.HybridDeploymentAgentId.ValueString()) + if data.LocalProcessingAgentId.ValueString() != "" { + svc.LocalProcessingAgentId(data.LocalProcessingAgentId.ValueString()) } if data.NetworkingMethod.ValueString() != "" { svc.NetworkingMethod(data.NetworkingMethod.ValueString()) - } + } if data.PrivateLinkId.ValueString() != "" { svc.PrivateLinkId(data.PrivateLinkId.ValueString()) @@ -291,13 +291,13 @@ func (r *destination) Update(ctx context.Context, req resource.UpdateRequest, re Region(plan.Region.ValueString()). DestinationID(state.Id.ValueString()) - if plan.HybridDeploymentAgentId.ValueString() != "" { - svc.HybridDeploymentAgentId(plan.HybridDeploymentAgentId.ValueString()) + if plan.LocalProcessingAgentId.ValueString() != "" { + svc.LocalProcessingAgentId(plan.LocalProcessingAgentId.ValueString()) } if plan.NetworkingMethod.ValueString() != "" { svc.NetworkingMethod(plan.NetworkingMethod.ValueString()) - } + } if plan.PrivateLinkId.ValueString() != "" { svc.PrivateLinkId(plan.PrivateLinkId.ValueString()) diff --git a/fivetran/framework/resources/destination_migrations.go b/fivetran/framework/resources/destination_migrations.go index c4f492c4..f64255c2 100644 --- a/fivetran/framework/resources/destination_migrations.go +++ b/fivetran/framework/resources/destination_migrations.go @@ -42,7 +42,9 @@ func upgradeDestinationState(ctx context.Context, req resource.UpgradeStateReque "time_zone_offset": rawState["time_zone_offset"], "setup_status": rawState["setup_status"], "daylight_saving_time_enabled": tftypes.NewValue(tftypes.Bool, nil), - "hybrid_deployment_agent_id": rawState["local_processing_agent_id"], + "local_processing_agent_id": tftypes.NewValue(tftypes.String, nil), + "networking_method": tftypes.NewValue(tftypes.String, nil), + "private_link_id": tftypes.NewValue(tftypes.String, nil), "run_setup_tests": convertStringStateValueToBool("run_setup_tests", rawState["run_setup_tests"], resp.Diagnostics), "trust_fingerprints": convertStringStateValueToBool("trust_fingerprints", rawState["trust_fingerprints"], resp.Diagnostics), @@ -74,7 +76,7 @@ func getDestinationStateModel(version int) tftypes.Type { }, }, } - if version == 1 || version == 2 { + if version == 1 || version == 2 { base["run_setup_tests"] = tftypes.Bool base["trust_certificates"] = tftypes.Bool base["trust_fingerprints"] = tftypes.Bool diff --git a/fivetran/tests/e2e/fivetran_test.go b/fivetran/tests/e2e/fivetran_test.go index 79d5506e..34caa9f8 100644 --- a/fivetran/tests/e2e/fivetran_test.go +++ b/fivetran/tests/e2e/fivetran_test.go @@ -90,7 +90,7 @@ func cleanupAccount() { cleanupTeams() cleanupProxyAgents() cleanupPrivateLinks() - cleanupHybridDeploymentAgents() + cleanupLocalProcessingAgents() } func isPredefinedUserExist() bool { @@ -295,19 +295,19 @@ func cleanupPrivateLinks() { } } -func cleanupHybridDeploymentAgents() { - lpaList, err := client.NewHybridDeploymentAgentList().Do(context.Background()) +func cleanupLocalProcessingAgents() { + lpaList, err := client.NewLocalProcessingAgentList().Do(context.Background()) if err != nil { log.Fatal(err) } for _, lpa := range lpaList.Data.Items { - _, err := client.NewHybridDeploymentAgentDelete().AgentId(lpa.Id).Do(context.Background()) + _, err := client.NewLocalProcessingAgentDelete().AgentId(lpa.Id).Do(context.Background()) if err != nil { log.Fatal(err) } } if lpaList.Data.NextCursor != "" { - cleanupHybridDeploymentAgents() + cleanupLocalProcessingAgents() } } diff --git a/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go b/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go index d0f86aff..490c2fb7 100644 --- a/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go +++ b/fivetran/tests/mock/resource_connector_dynamic_fields_mapping_test.go @@ -219,7 +219,6 @@ func getJsonConfigForFieldImpl(fieldName, service string, field common.ConfigFie } func getTfDestinationSchema(service string) string { - schemaFields := common.GetDestinationSchemaFields() if schemaFields[service]["schema"] { if schemaFields[service]["table"] { @@ -337,7 +336,7 @@ func TestResourceConnectorDynamicMapping(t *testing.T) { for len(*restFields) > 0 { stepFields, rest, service := fetchFieldsBatchByService(*restFields) - fmt.Printf("Service %v | Fields left to test: %v | Step fields count: %v | Fields rest %v \n", service, len(rest)+len(stepFields), len(stepFields), len(rest)) + fmt.Printf("Fields left to test: %v | Step fields count: %v | Fields rest %v \n", len(rest)+len(stepFields), len(stepFields), len(rest)) if debug { fmt.Printf("Testing fields for service %v : [\t\n%v]\n", service, strings.Join(stepFields, "\t\n ")) diff --git a/go.sum b/go.sum index 7093a704..56018fee 100644 --- a/go.sum +++ b/go.sum @@ -6,7 +6,6 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -31,12 +30,6 @@ github.com/fivetran/go-fivetran v0.9.2 h1:H3AY9nB3mJ7Kjd2vzT3bQfko5JZ/vVYu1zuM47 github.com/fivetran/go-fivetran v0.9.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/fivetran/go-fivetran v0.9.4 h1:9F7XzoezZxnhCW331NpN49ace8YfsJ8+92oyjxIj88o= github.com/fivetran/go-fivetran v0.9.4/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= -github.com/fivetran/go-fivetran v1.0.0 h1:dqGtgFlPBTxTrQlxMlsTYP17gV0BcLmkE+81KcDbTAg= -github.com/fivetran/go-fivetran v1.0.0/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= -github.com/fivetran/go-fivetran v1.0.1 h1:5qrqUIXPkAqH+IAN6jWzS51fH/BC7rKfViVyUNUUKU0= -github.com/fivetran/go-fivetran v1.0.1/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= -github.com/fivetran/go-fivetran v1.0.2 h1:AowFVwhQuPXqqdIVcQRcFqUbslYh2dZ+JVg2/9YTcvY= -github.com/fivetran/go-fivetran v1.0.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= @@ -68,56 +61,39 @@ github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUK github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= -github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= -github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= -github.com/hashicorp/hc-install v0.8.0/go.mod h1:+MwJYjDfCruSD/udvBmRB22Nlkwwkwf5sAB6uTIhSaU= github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= -github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= -github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= -github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI= github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY= -github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= -github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1/go.mod h1:MsjL1sQ9L7wGwzJ5RjcI6FzEMdyoBnw+XK8ZnOvQOLY= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 h1:3PCn9iyzdVOgHYOBmncpSSOxjQhCTYmc+PGvbdlqSaI= -github.com/hashicorp/terraform-plugin-framework-validators v0.14.0/go.mod h1:LwDKNdzxrDY/mHBrlC6aYfE2fQ3Dk3gaJD64vNiXvo4= github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= -github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= -github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= -github.com/hashicorp/terraform-plugin-testing v1.10.0/go.mod h1:iWRW3+loP33WMch2P/TEyCxxct/ZEcCGMquSLSCVsrc= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= @@ -185,24 +161,19 @@ github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -222,8 +193,6 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -233,14 +202,11 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -248,18 +214,12 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From b4b9a937dc661028252a453bad5815f122cdeec3 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 13:30:43 +0100 Subject: [PATCH 07/21] hda --- fivetran/framework/core/model/connector.go | 4 +- fivetran/framework/core/model/destination.go | 2 +- .../model/destination_datasource_model.go | 1 + .../core/model/destination_resource_model.go | 1 + .../core/model/local_processing_agent.go | 8 ++-- ...local_processing_agent_datasource_model.go | 6 +-- .../local_processing_agent_resource_model.go | 8 ++-- .../core/model/local_processing_agents.go | 4 +- .../datasources/local_processing_agent.go | 2 +- .../datasources/local_processing_agents.go | 10 ++--- fivetran/framework/resources/connector.go | 4 +- fivetran/framework/resources/destination.go | 4 +- .../resources/local_processing_agent.go | 8 ++-- go.mod | 2 +- go.sum | 38 +++++++++++++++++++ 15 files changed, 71 insertions(+), 31 deletions(-) diff --git a/fivetran/framework/core/model/connector.go b/fivetran/framework/core/model/connector.go index 9f83cc39..927d2218 100644 --- a/fivetran/framework/core/model/connector.go +++ b/fivetran/framework/core/model/connector.go @@ -310,8 +310,8 @@ func (c *ConnectorModelContainer) ReadFromResponseData(data connectors.DetailsRe c.NetworkingMethod = data.NetworkingMethod } - if data.LocalProcessingAgentId != "" { - c.LocalProcessingAgentId = data.LocalProcessingAgentId + if data.HybridDeploymentAgentId != "" { + c.LocalProcessingAgentId = data.HybridDeploymentAgentId } if data.PrivateLinkId != "" { diff --git a/fivetran/framework/core/model/destination.go b/fivetran/framework/core/model/destination.go index a30b5ed0..1b36f4e4 100644 --- a/fivetran/framework/core/model/destination.go +++ b/fivetran/framework/core/model/destination.go @@ -26,7 +26,7 @@ func readFromResponse(d destinationModel, resp destinations.DestinationDetailsBa d.SetSetupStatus(resp.SetupStatus) d.SetTimeZonOffset(resp.TimeZoneOffset) d.SetDaylightSavingTimeEnabled(resp.DaylightSavingTimeEnabled) - d.SetLocalProcessingAgentId(resp.LocalProcessingAgentId) + d.SetLocalProcessingAgentId(resp.HybridDeploymentAgentId) d.SetNetworkingMethod(resp.NetworkingMethod) d.SetPrivateLinkId(resp.PrivateLinkId) d.SetConfig(config) diff --git a/fivetran/framework/core/model/destination_datasource_model.go b/fivetran/framework/core/model/destination_datasource_model.go index 38c3b473..1beaa1bd 100644 --- a/fivetran/framework/core/model/destination_datasource_model.go +++ b/fivetran/framework/core/model/destination_datasource_model.go @@ -17,6 +17,7 @@ type DestinationDatasourceModel struct { DaylightSavingTimeEnabled types.Bool `tfsdk:"daylight_saving_time_enabled"` LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` NetworkingMethod types.String `tfsdk:"networking_method"` + PrivateLinkId types.String `tfsdk:"private_link_id"` Config types.Object `tfsdk:"config"` } diff --git a/fivetran/framework/core/model/destination_resource_model.go b/fivetran/framework/core/model/destination_resource_model.go index 8aa5d896..8ed14430 100644 --- a/fivetran/framework/core/model/destination_resource_model.go +++ b/fivetran/framework/core/model/destination_resource_model.go @@ -20,6 +20,7 @@ type DestinationResourceModel struct { Timeouts timeouts.Value `tfsdk:"timeouts"` LocalProcessingAgentId types.String `tfsdk:"local_processing_agent_id"` NetworkingMethod types.String `tfsdk:"networking_method"` + PrivateLinkId types.String `tfsdk:"private_link_id"` RunSetupTests types.Bool `tfsdk:"run_setup_tests"` TrustCertificates types.Bool `tfsdk:"trust_certificates"` diff --git a/fivetran/framework/core/model/local_processing_agent.go b/fivetran/framework/core/model/local_processing_agent.go index 1acbce32..7b520422 100644 --- a/fivetran/framework/core/model/local_processing_agent.go +++ b/fivetran/framework/core/model/local_processing_agent.go @@ -1,7 +1,7 @@ package model import ( - "github.com/fivetran/go-fivetran/local_processing_agent" + localprocessingagent "github.com/fivetran/go-fivetran/hybrid_deployment_agent" ) type localProcessingAgentModel interface { @@ -12,10 +12,10 @@ type localProcessingAgentModel interface { SetConfigJson(string) SetAuthJson(string) SetDockerComposeYaml(string) - SetUsage([]localprocessingagent.LocalProcessingAgentUsageDetails) + SetUsage([]localprocessingagent.HybridDeploymentAgentUsageDetails) } -func readLocalProcessingAgentFromResponse(d localProcessingAgentModel, resp localprocessingagent.LocalProcessingAgentDetailsResponse) { +func readLocalProcessingAgentFromResponse(d localProcessingAgentModel, resp localprocessingagent.HybridDeploymentAgentDetailsResponse) { d.SetId(resp.Data.Id) d.SetDisplayName(resp.Data.DisplayName) d.SetGroupId(resp.Data.GroupId) @@ -23,7 +23,7 @@ func readLocalProcessingAgentFromResponse(d localProcessingAgentModel, resp loca d.SetUsage(resp.Data.Usage) } -func readLocalProcessingAgentFromCreateResponse(d localProcessingAgentModel, resp localprocessingagent.LocalProcessingAgentCreateResponse) { +func readLocalProcessingAgentFromCreateResponse(d localProcessingAgentModel, resp localprocessingagent.HybridDeploymentAgentCreateResponse) { d.SetId(resp.Data.Id) d.SetDisplayName(resp.Data.DisplayName) d.SetGroupId(resp.Data.GroupId) diff --git a/fivetran/framework/core/model/local_processing_agent_datasource_model.go b/fivetran/framework/core/model/local_processing_agent_datasource_model.go index 83273d94..1c9ab041 100644 --- a/fivetran/framework/core/model/local_processing_agent_datasource_model.go +++ b/fivetran/framework/core/model/local_processing_agent_datasource_model.go @@ -1,7 +1,7 @@ package model import ( - "github.com/fivetran/go-fivetran/local_processing_agent" + localprocessingagent "github.com/fivetran/go-fivetran/hybrid_deployment_agent" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/attr" ) @@ -36,7 +36,7 @@ func (d *LocalProcessingAgentDatasourceModel) SetDisplayName(value string) { func (d *LocalProcessingAgentDatasourceModel) SetRegisteredAt(value string) { d.RegisteredAt = types.StringValue(value) } -func (d *LocalProcessingAgentDatasourceModel) SetUsage(value []localprocessingagent.LocalProcessingAgentUsageDetails) { +func (d *LocalProcessingAgentDatasourceModel) SetUsage(value []localprocessingagent.HybridDeploymentAgentUsageDetails) { if value == nil { d.Usage = types.SetNull(types.ObjectType{AttrTypes: elementType}) } @@ -59,7 +59,7 @@ func (d *LocalProcessingAgentDatasourceModel) SetConfigJson(value string) {} func (d *LocalProcessingAgentDatasourceModel) SetAuthJson(value string) {} func (d *LocalProcessingAgentDatasourceModel) SetDockerComposeYaml(value string) {} -func (d *LocalProcessingAgentDatasourceModel) ReadFromResponse(resp localprocessingagent.LocalProcessingAgentDetailsResponse) { +func (d *LocalProcessingAgentDatasourceModel) ReadFromResponse(resp localprocessingagent.HybridDeploymentAgentDetailsResponse) { var model localProcessingAgentModel = d readLocalProcessingAgentFromResponse(model, resp) } \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agent_resource_model.go b/fivetran/framework/core/model/local_processing_agent_resource_model.go index 550e0999..4957d05d 100644 --- a/fivetran/framework/core/model/local_processing_agent_resource_model.go +++ b/fivetran/framework/core/model/local_processing_agent_resource_model.go @@ -1,7 +1,7 @@ package model import ( - "github.com/fivetran/go-fivetran/local_processing_agent" + localprocessingagent "github.com/fivetran/go-fivetran/hybrid_deployment_agent" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/attr" ) @@ -41,7 +41,7 @@ func (d *LocalProcessingAgentResourceModel) SetAuthJson(value string) { func (d *LocalProcessingAgentResourceModel) SetDockerComposeYaml(value string) { d.DockerComposeYaml = types.StringValue(value) } -func (d *LocalProcessingAgentResourceModel) SetUsage(value []localprocessingagent.LocalProcessingAgentUsageDetails) { +func (d *LocalProcessingAgentResourceModel) SetUsage(value []localprocessingagent.HybridDeploymentAgentUsageDetails) { if value == nil { d.Usage = types.SetNull(types.ObjectType{AttrTypes: elementType}) } @@ -59,13 +59,13 @@ func (d *LocalProcessingAgentResourceModel) SetUsage(value []localprocessingagen d.Usage, _ = types.SetValue(types.ObjectType{AttrTypes: elementType}, items) } -func (d *LocalProcessingAgentResourceModel) ReadFromCreateResponse(resp localprocessingagent.LocalProcessingAgentCreateResponse) { +func (d *LocalProcessingAgentResourceModel) ReadFromCreateResponse(resp localprocessingagent.HybridDeploymentAgentCreateResponse) { var model localProcessingAgentModel = d readLocalProcessingAgentFromCreateResponse(model, resp) d.AuthenticationCounter = types.Int64Value(d.AuthenticationCounter.ValueInt64() + 1) } -func (d *LocalProcessingAgentResourceModel) ReadFromResponse(resp localprocessingagent.LocalProcessingAgentDetailsResponse) { +func (d *LocalProcessingAgentResourceModel) ReadFromResponse(resp localprocessingagent.HybridDeploymentAgentDetailsResponse) { var model localProcessingAgentModel = d readLocalProcessingAgentFromResponse(model, resp) } \ No newline at end of file diff --git a/fivetran/framework/core/model/local_processing_agents.go b/fivetran/framework/core/model/local_processing_agents.go index 20b7a3d7..a8596ccd 100644 --- a/fivetran/framework/core/model/local_processing_agents.go +++ b/fivetran/framework/core/model/local_processing_agents.go @@ -3,7 +3,7 @@ package model import ( "context" - "github.com/fivetran/go-fivetran/local_processing_agent" + localprocessingagent "github.com/fivetran/go-fivetran/hybrid_deployment_agent" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/attr" ) @@ -12,7 +12,7 @@ type LocalProcessingAgents struct { Items types.Set `tfsdk:"items"` } -func (d *LocalProcessingAgents) ReadFromResponse(ctx context.Context, resp localprocessingagent.LocalProcessingAgentListResponse) { +func (d *LocalProcessingAgents) ReadFromResponse(ctx context.Context, resp localprocessingagent.HybridDeploymentAgentListResponse) { subSetElementType := map[string]attr.Type{ "connection_id": types.StringType, "schema": types.StringType, diff --git a/fivetran/framework/datasources/local_processing_agent.go b/fivetran/framework/datasources/local_processing_agent.go index 28840514..3e588bca 100644 --- a/fivetran/framework/datasources/local_processing_agent.go +++ b/fivetran/framework/datasources/local_processing_agent.go @@ -44,7 +44,7 @@ func (d *localProcessingAgent) Read(ctx context.Context, req datasource.ReadRequ resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) - detailsResponse, err := d.GetClient().NewLocalProcessingAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) + detailsResponse, err := d.GetClient().NewHybridDeploymentAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( diff --git a/fivetran/framework/datasources/local_processing_agents.go b/fivetran/framework/datasources/local_processing_agents.go index 3b71d769..b1034a15 100644 --- a/fivetran/framework/datasources/local_processing_agents.go +++ b/fivetran/framework/datasources/local_processing_agents.go @@ -7,7 +7,7 @@ import ( "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core" "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/model" "github.com/hashicorp/terraform-plugin-framework/datasource" - sdk "github.com/fivetran/go-fivetran/local_processing_agent" + sdk "github.com/fivetran/go-fivetran/hybrid_deployment_agent" fivetranSchema "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/core/schema" ) @@ -45,13 +45,13 @@ func (d *localProcessingAgents) Read(ctx context.Context, req datasource.ReadReq resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) var respNextCursor string - var listResponse sdk.LocalProcessingAgentListResponse + var listResponse sdk.HybridDeploymentAgentListResponse limit := 1000 for { var err error - var tmpResp sdk.LocalProcessingAgentListResponse - svc := d.GetClient().NewLocalProcessingAgentList() + var tmpResp sdk.HybridDeploymentAgentListResponse + svc := d.GetClient().NewHybridDeploymentAgentList() if respNextCursor == "" { tmpResp, err = svc.Limit(limit).Do(ctx) @@ -66,7 +66,7 @@ func (d *localProcessingAgents) Read(ctx context.Context, req datasource.ReadReq "Read error.", fmt.Sprintf("%v; code: %v", err, tmpResp.Code), ) - listResponse = sdk.LocalProcessingAgentListResponse{} + listResponse = sdk.HybridDeploymentAgentListResponse{} } listResponse.Data.Items = append(listResponse.Data.Items, tmpResp.Data.Items...) diff --git a/fivetran/framework/resources/connector.go b/fivetran/framework/resources/connector.go index 840c7642..a7014f8a 100644 --- a/fivetran/framework/resources/connector.go +++ b/fivetran/framework/resources/connector.go @@ -159,7 +159,7 @@ func (r *connector) Create(ctx context.Context, req resource.CreateRequest, resp } if data.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(data.LocalProcessingAgentId.ValueString()) + svc.HybridDeploymentAgentId(data.LocalProcessingAgentId.ValueString()) } if data.PrivateLinkId.ValueString() != "" { @@ -327,7 +327,7 @@ func (r *connector) Update(ctx context.Context, req resource.UpdateRequest, resp ConnectorID(state.Id.ValueString()) if plan.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(plan.LocalProcessingAgentId.ValueString()) + svc.HybridDeploymentAgentId(plan.LocalProcessingAgentId.ValueString()) } if plan.PrivateLinkId.ValueString() != "" { diff --git a/fivetran/framework/resources/destination.go b/fivetran/framework/resources/destination.go index 55404a1b..21cc359c 100644 --- a/fivetran/framework/resources/destination.go +++ b/fivetran/framework/resources/destination.go @@ -106,7 +106,7 @@ func (r *destination) Create(ctx context.Context, req resource.CreateRequest, re ConfigCustom(&configMap) if data.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(data.LocalProcessingAgentId.ValueString()) + svc.HybridDeploymentAgentId(data.LocalProcessingAgentId.ValueString()) } if data.NetworkingMethod.ValueString() != "" { @@ -292,7 +292,7 @@ func (r *destination) Update(ctx context.Context, req resource.UpdateRequest, re DestinationID(state.Id.ValueString()) if plan.LocalProcessingAgentId.ValueString() != "" { - svc.LocalProcessingAgentId(plan.LocalProcessingAgentId.ValueString()) + svc.HybridDeploymentAgentId(plan.LocalProcessingAgentId.ValueString()) } if plan.NetworkingMethod.ValueString() != "" { diff --git a/fivetran/framework/resources/local_processing_agent.go b/fivetran/framework/resources/local_processing_agent.go index 7f5b09db..6652ff0c 100644 --- a/fivetran/framework/resources/local_processing_agent.go +++ b/fivetran/framework/resources/local_processing_agent.go @@ -54,7 +54,7 @@ func (r *localProcessingAgent) Create(ctx context.Context, req resource.CreateRe return } - svc := r.GetClient().NewLocalProcessingAgentCreate() + svc := r.GetClient().NewHybridDeploymentAgentCreate() svc.GroupId(data.GroupId.ValueString()) svc.DisplayName(data.DisplayName.ValueString()) svc.EnvType("DOCKER") @@ -90,7 +90,7 @@ func (r *localProcessingAgent) Read(ctx context.Context, req resource.ReadReques // Read Terraform prior state data into the model resp.Diagnostics.Append(req.State.Get(ctx, &data)...) - readResponse, err := r.GetClient().NewLocalProcessingAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) + readResponse, err := r.GetClient().NewHybridDeploymentAgentDetails().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( @@ -120,7 +120,7 @@ func (r *localProcessingAgent) Update(ctx context.Context, req resource.UpdateRe resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - svc := r.GetClient().NewLocalProcessingAgentReAuth().AgentId(state.Id.ValueString()) + svc := r.GetClient().NewHybridDeploymentAgentReAuth().AgentId(state.Id.ValueString()) updateResponse, err := svc.Do(ctx) if err != nil { @@ -150,7 +150,7 @@ func (r *localProcessingAgent) Delete(ctx context.Context, req resource.DeleteRe resp.Diagnostics.Append(req.State.Get(ctx, &data)...) - deleteResponse, err := r.GetClient().NewLocalProcessingAgentDelete().AgentId(data.Id.ValueString()).Do(ctx) + deleteResponse, err := r.GetClient().NewHybridDeploymentAgentDelete().AgentId(data.Id.ValueString()).Do(ctx) if err != nil { resp.Diagnostics.AddError( "Unable to Delete Local Processing Agent Resource.", diff --git a/go.mod b/go.mod index 6ddb5756..9853d1ac 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/fivetran/terraform-provider-fivetran require ( - github.com/fivetran/go-fivetran v1.0.1 + github.com/fivetran/go-fivetran v1.0.2 github.com/hashicorp/terraform-plugin-framework v1.12.0 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 diff --git a/go.sum b/go.sum index 56018fee..c109f814 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -30,6 +31,10 @@ github.com/fivetran/go-fivetran v0.9.2 h1:H3AY9nB3mJ7Kjd2vzT3bQfko5JZ/vVYu1zuM47 github.com/fivetran/go-fivetran v0.9.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/fivetran/go-fivetran v0.9.4 h1:9F7XzoezZxnhCW331NpN49ace8YfsJ8+92oyjxIj88o= github.com/fivetran/go-fivetran v0.9.4/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= +github.com/fivetran/go-fivetran v1.0.1 h1:5qrqUIXPkAqH+IAN6jWzS51fH/BC7rKfViVyUNUUKU0= +github.com/fivetran/go-fivetran v1.0.1/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= +github.com/fivetran/go-fivetran v1.0.2 h1:AowFVwhQuPXqqdIVcQRcFqUbslYh2dZ+JVg2/9YTcvY= +github.com/fivetran/go-fivetran v1.0.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= @@ -61,39 +66,56 @@ github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUK github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= +github.com/hashicorp/hc-install v0.8.0/go.mod h1:+MwJYjDfCruSD/udvBmRB22Nlkwwkwf5sAB6uTIhSaU= github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= +github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= +github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= +github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI= github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY= +github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= +github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1/go.mod h1:MsjL1sQ9L7wGwzJ5RjcI6FzEMdyoBnw+XK8ZnOvQOLY= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= +github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 h1:3PCn9iyzdVOgHYOBmncpSSOxjQhCTYmc+PGvbdlqSaI= +github.com/hashicorp/terraform-plugin-framework-validators v0.14.0/go.mod h1:LwDKNdzxrDY/mHBrlC6aYfE2fQ3Dk3gaJD64vNiXvo4= github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= +github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= +github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= +github.com/hashicorp/terraform-plugin-testing v1.10.0/go.mod h1:iWRW3+loP33WMch2P/TEyCxxct/ZEcCGMquSLSCVsrc= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= @@ -161,19 +183,24 @@ github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -193,6 +220,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -202,11 +231,14 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -214,12 +246,18 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 467e704695b10f0163db738a970b5f24037a18d1 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 13:33:17 +0100 Subject: [PATCH 08/21] docs --- docs/data-sources/connector.md | 2 +- docs/data-sources/destination.md | 2 +- docs/resources/connector.md | 2 +- docs/resources/destination.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/data-sources/connector.md b/docs/data-sources/connector.md index 4ce4969b..92a4e313 100644 --- a/docs/data-sources/connector.md +++ b/docs/data-sources/connector.md @@ -30,7 +30,7 @@ data "fivetran_connector" "connector" { - `destination_schema` (Block, Read-only) (see [below for nested schema](#nestedblock--destination_schema)) - `failed_at` (String) The timestamp of the time the connector sync failed last time. - `group_id` (String) The unique identifier for the Group (Destination) within the Fivetran system. -- `hybrid_deployment_agent_id` (String) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `name` (String) The name used both as the connector's name within the Fivetran system and as the source schema's name within your destination. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. - `pause_after_trial` (Boolean) Specifies whether the connector should be paused after the free trial period has ended. diff --git a/docs/data-sources/destination.md b/docs/data-sources/destination.md index bc59d94a..d715f20b 100644 --- a/docs/data-sources/destination.md +++ b/docs/data-sources/destination.md @@ -26,7 +26,7 @@ data "fivetran_destination" "dest" { - `config` (Block, Read-only) (see [below for nested schema](#nestedblock--config)) - `daylight_saving_time_enabled` (Boolean) Shift my UTC offset with daylight savings time (US Only) - `group_id` (String) The unique identifier for the Group within the Fivetran system. -- `hybrid_deployment_agent_id` (String) The lhybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. - `private_link_id` (String) The private link ID. - `region` (String) Data processing location. This is where Fivetran will operate and run computation on data. diff --git a/docs/resources/connector.md b/docs/resources/connector.md index f4cfd818..9d5f968e 100644 --- a/docs/resources/connector.md +++ b/docs/resources/connector.md @@ -70,7 +70,7 @@ resource "fivetran_connector" "amplitude" { - `auth` (Block, Optional) (see [below for nested schema](#nestedblock--auth)) - `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) - `destination_schema` (Block, Optional) (see [below for nested schema](#nestedblock--destination_schema)) -- `hybrid_deployment_agent_id` (String) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. - `private_link_id` (String) The private link ID. - `proxy_agent_id` (String) The proxy agent ID. diff --git a/docs/resources/destination.md b/docs/resources/destination.md index f0ec06d4..594e1e1a 100644 --- a/docs/resources/destination.md +++ b/docs/resources/destination.md @@ -48,7 +48,7 @@ resource "fivetran_destination" "dest" { - `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) - `daylight_saving_time_enabled` (Boolean) Shift my UTC offset with daylight savings time (US Only) -- `hybrid_deployment_agent_id` (String) The lhybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. +- `local_processing_agent_id` (String) The local processing agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent. - `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent. - `private_link_id` (String) The private link ID. - `run_setup_tests` (Boolean) Specifies whether the setup tests should be run automatically. The default value is TRUE. From f5c303affa0f2712790e6d7716fb6bf500f57a13 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 13:46:59 +0100 Subject: [PATCH 09/21] Update connector.go --- fivetran/framework/core/model/connector.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fivetran/framework/core/model/connector.go b/fivetran/framework/core/model/connector.go index 927d2218..8ca64edf 100644 --- a/fivetran/framework/core/model/connector.go +++ b/fivetran/framework/core/model/connector.go @@ -205,6 +205,8 @@ func (d *ConnectorResourceModel) ReadFromContainer(c ConnectorModelContainer, fo d.LocalProcessingAgentId = types.StringNull() } + d.DestinationSchema = getDestinationSchemaValue(c.Service, c.Schema) + if c.PrivateLinkId != "" { d.PrivateLinkId = types.StringValue(c.PrivateLinkId) } else { @@ -238,6 +240,14 @@ func (d *ConnectorDatasourceModel) ReadFromContainer(c ConnectorModelContainer) d.GroupId = types.StringValue(c.GroupId) d.Service = types.StringValue(c.Service) + if c.LocalProcessingAgentId != "" { + d.LocalProcessingAgentId = types.StringValue(c.LocalProcessingAgentId) + } else { + d.LocalProcessingAgentId = types.StringNull() + } + + d.DestinationSchema = getDestinationSchemaValue(c.Service, c.Schema) + if c.PrivateLinkId != "" { d.PrivateLinkId = types.StringValue(c.PrivateLinkId) } else { @@ -254,14 +264,6 @@ func (d *ConnectorDatasourceModel) ReadFromContainer(c ConnectorModelContainer) d.NetworkingMethod = types.StringValue(c.NetworkingMethod) } - if c.LocalProcessingAgentId != "" { - d.LocalProcessingAgentId = types.StringValue(c.LocalProcessingAgentId) - } else { - d.LocalProcessingAgentId = types.StringNull() - } - - d.DestinationSchema = getDestinationSchemaValue(c.Service, c.Schema) - d.Config = getValue( types.ObjectType{AttrTypes: getAttrTypes(common.GetConfigFieldsMap())}, c.Config, From c1dd2df07227fab641a708f2a64819ba80962ea2 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 13:48:33 +0100 Subject: [PATCH 10/21] fix --- go.mod | 2 +- go.sum | 146 +-------------------------------------------------------- 2 files changed, 3 insertions(+), 145 deletions(-) diff --git a/go.mod b/go.mod index 9853d1ac..e63cc44b 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/fivetran/terraform-provider-fivetran require ( - github.com/fivetran/go-fivetran v1.0.2 + github.com/fivetran/go-fivetran v1.0.3 github.com/hashicorp/terraform-plugin-framework v1.12.0 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 diff --git a/go.sum b/go.sum index c109f814..d652afb9 100644 --- a/go.sum +++ b/go.sum @@ -1,211 +1,91 @@ -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/Jeffail/gabs/v2 v2.7.0 h1:Y2edYaTcE8ZpRsR2AtmPu5xQdFDIthFG0jYhu5PY8kg= github.com/Jeffail/gabs/v2 v2.7.0/go.mod h1:dp5ocw1FvBBQYssgHsG7I1WYsiLRtkUaB1FEtSwvNUw= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= -github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= -github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= -github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= -github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/fivetran/go-fivetran v0.9.2 h1:H3AY9nB3mJ7Kjd2vzT3bQfko5JZ/vVYu1zuM47bRaG8= -github.com/fivetran/go-fivetran v0.9.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= -github.com/fivetran/go-fivetran v0.9.4 h1:9F7XzoezZxnhCW331NpN49ace8YfsJ8+92oyjxIj88o= -github.com/fivetran/go-fivetran v0.9.4/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= -github.com/fivetran/go-fivetran v1.0.1 h1:5qrqUIXPkAqH+IAN6jWzS51fH/BC7rKfViVyUNUUKU0= -github.com/fivetran/go-fivetran v1.0.1/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= -github.com/fivetran/go-fivetran v1.0.2 h1:AowFVwhQuPXqqdIVcQRcFqUbslYh2dZ+JVg2/9YTcvY= -github.com/fivetran/go-fivetran v1.0.2/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= -github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= -github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= -github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= -github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/fivetran/go-fivetran v1.0.3 h1:1x/lmuvvQj7DPICoMZDi8bQitgtDm767SJ3to5RYwD8= +github.com/fivetran/go-fivetran v1.0.3/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= -github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= -github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= -github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= -github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= -github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= -github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= github.com/hashicorp/hc-install v0.8.0/go.mod h1:+MwJYjDfCruSD/udvBmRB22Nlkwwkwf5sAB6uTIhSaU= -github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= -github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= -github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= -github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= -github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= -github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= -github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI= -github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY= -github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ= github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= -github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1/go.mod h1:MsjL1sQ9L7wGwzJ5RjcI6FzEMdyoBnw+XK8ZnOvQOLY= -github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= -github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 h1:3PCn9iyzdVOgHYOBmncpSSOxjQhCTYmc+PGvbdlqSaI= github.com/hashicorp/terraform-plugin-framework-validators v0.14.0/go.mod h1:LwDKNdzxrDY/mHBrlC6aYfE2fQ3Dk3gaJD64vNiXvo4= -github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= -github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= -github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U= github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= -github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= -github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= -github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= github.com/hashicorp/terraform-plugin-testing v1.10.0/go.mod h1:iWRW3+loP33WMch2P/TEyCxxct/ZEcCGMquSLSCVsrc= -github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= -github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= -github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= -github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= -github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= -github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= -github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= -github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= -github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= -github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -218,9 +98,6 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -229,40 +106,21 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 9ca5d8ed4dda8e7215d1dcbaee71bd751110ed87 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 15:55:37 +0100 Subject: [PATCH 11/21] fix --- go.mod | 56 ++++++++++++++++++++----------------------- go.sum | 76 +++++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 75 insertions(+), 57 deletions(-) diff --git a/go.mod b/go.mod index e63cc44b..8cf63250 100644 --- a/go.mod +++ b/go.mod @@ -2,46 +2,42 @@ module github.com/fivetran/terraform-provider-fivetran require ( github.com/fivetran/go-fivetran v1.0.3 - github.com/hashicorp/terraform-plugin-framework v1.12.0 + github.com/hashicorp/terraform-plugin-framework v1.8.0 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 - github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 - github.com/hashicorp/terraform-plugin-testing v1.10.0 + github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 + github.com/hashicorp/terraform-plugin-testing v1.7.0 ) require ( - github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect + github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect - github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - golang.org/x/mod v0.19.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + golang.org/x/mod v0.15.0 // indirect + golang.org/x/tools v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect ) require ( - github.com/Jeffail/gabs/v2 v2.7.0 - github.com/agext/levenshtein v1.2.2 // indirect - github.com/fatih/color v1.16.0 // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect - github.com/hashicorp/go-hclog v1.6.3 // indirect + github.com/hashicorp/go-hclog v1.6.2 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.1 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect - github.com/hashicorp/hc-install v0.8.0 // indirect - github.com/hashicorp/hcl/v2 v2.21.0 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/hc-install v0.6.3 // indirect + github.com/hashicorp/hcl/v2 v2.20.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.21.0 // indirect - github.com/hashicorp/terraform-json v0.22.1 // indirect - github.com/hashicorp/terraform-plugin-go v0.24.0 + github.com/hashicorp/terraform-exec v0.20.0 // indirect + github.com/hashicorp/terraform-json v0.21.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.22.2 github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect @@ -56,16 +52,16 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.0.0 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/zclconf/go-cty v1.15.0 // indirect - golang.org/x/crypto v0.26.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + github.com/zclconf/go-cty v1.14.3 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/grpc v1.66.2 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/grpc v1.63.2 // indirect + google.golang.org/protobuf v1.33.0 // indirect ) -go 1.22.0 +go 1.21 toolchain go1.22.1 diff --git a/go.sum b/go.sum index d652afb9..57f98caf 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,4 @@ -github.com/Jeffail/gabs/v2 v2.7.0/go.mod h1:dp5ocw1FvBBQYssgHsG7I1WYsiLRtkUaB1FEtSwvNUw= -github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= @@ -8,42 +6,53 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fivetran/go-fivetran v1.0.3 h1:1x/lmuvvQj7DPICoMZDi8bQitgtDm767SJ3to5RYwD8= github.com/fivetran/go-fivetran v1.0.3/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= +github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.8.0/go.mod h1:+MwJYjDfCruSD/udvBmRB22Nlkwwkwf5sAB6uTIhSaU= -github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= +github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= -github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= -github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE= +github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= +github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= +github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI= +github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY= +github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E= github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1/go.mod h1:MsjL1sQ9L7wGwzJ5RjcI6FzEMdyoBnw+XK8ZnOvQOLY= -github.com/hashicorp/terraform-plugin-framework-validators v0.14.0/go.mod h1:LwDKNdzxrDY/mHBrlC6aYfE2fQ3Dk3gaJD64vNiXvo4= -github.com/hashicorp/terraform-plugin-go v0.24.0/go.mod h1:tUQ53lAsOyYSckFGEefGC5C8BAaO0ENqzFd3bQeuYQg= +github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= +github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= +github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= +github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= +github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= -github.com/hashicorp/terraform-plugin-testing v1.10.0/go.mod h1:iWRW3+loP33WMch2P/TEyCxxct/ZEcCGMquSLSCVsrc= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= +github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= +github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= +github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -52,37 +61,45 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -98,7 +115,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -106,20 +124,24 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= From a9b7c2fdc997ce017fa6758febfda96505e1ea03 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 15:56:59 +0100 Subject: [PATCH 12/21] fix build --- go.mod | 8 ++++++-- go.sum | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8cf63250..69b32f2d 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,6 @@ require ( github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect - github.com/fatih/color v1.16.0 // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect @@ -24,6 +22,12 @@ require ( ) require ( + github.com/Jeffail/gabs/v2 v2.7.0 + github.com/agext/levenshtein v1.2.2 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect diff --git a/go.sum b/go.sum index 57f98caf..97b602e7 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ +github.com/Jeffail/gabs/v2 v2.7.0/go.mod h1:dp5ocw1FvBBQYssgHsG7I1WYsiLRtkUaB1FEtSwvNUw= github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= @@ -17,7 +19,9 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= From aa4c72e3d8e26681b8502b01860baf19a39544f6 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 16:00:35 +0100 Subject: [PATCH 13/21] Update go.mod --- go.mod | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 69b32f2d..91ae5a9b 100644 --- a/go.mod +++ b/go.mod @@ -22,11 +22,11 @@ require ( ) require ( - github.com/Jeffail/gabs/v2 v2.7.0 - github.com/agext/levenshtein v1.2.2 // indirect - github.com/fatih/color v1.16.0 // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/Jeffail/gabs/v2 v2.7.0 + github.com/agext/levenshtein v1.2.2 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect From 35ca8e4b2250df4e853952c7cce0d9fe492e7854 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 16:02:10 +0100 Subject: [PATCH 14/21] fix --- go.sum | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/go.sum b/go.sum index 97b602e7..f7260a38 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,12 @@ github.com/Jeffail/gabs/v2 v2.7.0/go.mod h1:dp5ocw1FvBBQYssgHsG7I1WYsiLRtkUaB1FEtSwvNUw= +github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -19,26 +23,38 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= +github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4= github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk= +github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= +github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI= github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY= @@ -50,7 +66,9 @@ github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3 github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= +github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= github.com/hashicorp/terraform-plugin-testing v1.7.0/go.mod h1:sbAreCleJNOCz+y5vVHV8EJkIWZKi/t4ndKiUjM9vao= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= @@ -72,11 +90,15 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= @@ -92,11 +114,14 @@ github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21 github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -133,10 +158,12 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= From 59ac949d1acb66cece45ae8a7a9d999ac0ca1176 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 16:04:13 +0100 Subject: [PATCH 15/21] Update go.sum --- go.sum | 1 + 1 file changed, 1 insertion(+) diff --git a/go.sum b/go.sum index f7260a38..440b062e 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +github.com/Jeffail/gabs/v2 v2.7.0 h1:Y2edYaTcE8ZpRsR2AtmPu5xQdFDIthFG0jYhu5PY8kg= github.com/Jeffail/gabs/v2 v2.7.0/go.mod h1:dp5ocw1FvBBQYssgHsG7I1WYsiLRtkUaB1FEtSwvNUw= github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= From ee21ae45a679613b77bc00b8aa833394468dcec8 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 16:17:03 +0100 Subject: [PATCH 16/21] fixes --- fivetran/tests/e2e/fivetran_test.go | 4 ++-- .../tests/e2e/resource_local_processing_agent_e2e_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fivetran/tests/e2e/fivetran_test.go b/fivetran/tests/e2e/fivetran_test.go index 34caa9f8..30239de5 100644 --- a/fivetran/tests/e2e/fivetran_test.go +++ b/fivetran/tests/e2e/fivetran_test.go @@ -296,12 +296,12 @@ func cleanupPrivateLinks() { } func cleanupLocalProcessingAgents() { - lpaList, err := client.NewLocalProcessingAgentList().Do(context.Background()) + lpaList, err := client.NewHybridDeploymentAgentList().Do(context.Background()) if err != nil { log.Fatal(err) } for _, lpa := range lpaList.Data.Items { - _, err := client.NewLocalProcessingAgentDelete().AgentId(lpa.Id).Do(context.Background()) + _, err := client.NewHybridDeploymentAgentDelete().AgentId(lpa.Id).Do(context.Background()) if err != nil { log.Fatal(err) } diff --git a/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go b/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go index 256a75db..a0cea9e6 100644 --- a/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go +++ b/fivetran/tests/e2e/resource_local_processing_agent_e2e_test.go @@ -43,7 +43,7 @@ func testFivetranLocalProcessingAgentResourceCreate(t *testing.T, resourceName s return func(s *terraform.State) error { rs := GetResource(t, s, resourceName) - _, err := client.NewLocalProcessingAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) + _, err := client.NewHybridDeploymentAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) if err != nil { fmt.Println(err) return err @@ -59,7 +59,7 @@ func testFivetranLocalProcessingAgentResourceDestroy(s *terraform.State) error { continue } - response, err := client.NewLocalProcessingAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) + response, err := client.NewHybridDeploymentAgentDetails().AgentId(rs.Primary.ID).Do(context.Background()) if err.Error() != "status code: 404; expected: 200" { return err } From 17dac48efbb0a2d3415abb7db6be41a4cfa91ddf Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Fri, 1 Nov 2024 16:26:20 +0100 Subject: [PATCH 17/21] fix tests --- fivetran/framework/core/model/private_link.go | 3 +-- .../datasources/local_processing_agent_test.go | 8 +------- .../local_processing_agents_test.go | 18 ++---------------- .../resources/local_processing_agent_test.go | 6 +++--- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/fivetran/framework/core/model/private_link.go b/fivetran/framework/core/model/private_link.go index 2bfa2310..bdc50e4b 100644 --- a/fivetran/framework/core/model/private_link.go +++ b/fivetran/framework/core/model/private_link.go @@ -21,7 +21,6 @@ type PrivateLink struct { CreatedBy types.String `tfsdk:"created_by"` Config types.Object `tfsdk:"config"` - CustomConfig types.Object `tfsdk:"custom_config"` } var PrivateLinkConfigType = map[string]attr.Type{ @@ -203,7 +202,7 @@ func (d *PrivateLink) ReadFromCustomResponse(ctx context.Context, resp privateli } func (d *PrivateLink) GetConfig() map[string]interface{} { - attr := d.CustomConfig.Attributes() + attr := d.Config.Attributes() config := make(map[string]interface{}) for k, v := range attr{ diff --git a/fivetran/framework/datasources/local_processing_agent_test.go b/fivetran/framework/datasources/local_processing_agent_test.go index 66faa40c..8f57ebf5 100644 --- a/fivetran/framework/datasources/local_processing_agent_test.go +++ b/fivetran/framework/datasources/local_processing_agent_test.go @@ -41,7 +41,7 @@ const ( func setupMockClientLocalProcessingAgentDataSourceConfigMapping(t *testing.T) { tfmock.MockClient().Reset() - lpaDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents/lpa_id").ThenCall( + lpaDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( func(req *http.Request) (*http.Response, error) { lpaDataSourceMockData = tfmock.CreateMapFromJsonString(t, lpaMappingResponse) return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", lpaDataSourceMockData), nil @@ -66,12 +66,6 @@ func TestDataSourceLocalProcessingAgentMappingMock(t *testing.T) { resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "display_name", "display_name"), resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "group_id", "group_id"), resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "registered_at", "registered_at"), - /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.connection_id", "connection_id1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.schema", "schema1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.0.service", "service1"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.connection_id", "connection_id2"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.schema", "schema2"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agent.test_lpa", "usage.1.service", "service2"),*/ ), } diff --git a/fivetran/framework/datasources/local_processing_agents_test.go b/fivetran/framework/datasources/local_processing_agents_test.go index 259242d8..c1cb2842 100644 --- a/fivetran/framework/datasources/local_processing_agents_test.go +++ b/fivetran/framework/datasources/local_processing_agents_test.go @@ -63,7 +63,7 @@ const ( func setupMockClientLocalProcessingAgentsDataSourceConfigMapping(t *testing.T) { tfmock.MockClient().Reset() - localProcessingAgentsDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents").ThenCall( + localProcessingAgentsDataSourceMockGetHandler = tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents").ThenCall( func(req *http.Request) (*http.Response, error) { localProcessingAgentsDataSourceMockData = tfmock.CreateMapFromJsonString(t, localProcessingAgentsMappingResponse) return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "Success", localProcessingAgentsDataSourceMockData), nil @@ -87,23 +87,9 @@ func TestDataSourceLocalProcessingAgentsMappingMock(t *testing.T) { resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.display_name", "display_name1"), resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.group_id", "group_id1"), resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.registered_at", "registered_at1"), - /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.connection_id", "connection_id11"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.schema", "schema11"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.0.service", "service11"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.connection_id", "connection_id12"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.schema", "schema12"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.0.usage.1.service", "service12"),*/ - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.display_name", "display_name2"), resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.group_id", "group_id2"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.registered_at", "registered_at2"), - /*resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.connection_id", "connection_id21"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.schema", "schema21"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.0.service", "service21"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.connection_id", "connection_id22"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.schema", "schema22"), - resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.usage.1.service", "service22"),*/ - ), + resource.TestCheckResourceAttr("data.fivetran_local_processing_agents.test_lpa", "items.1.registered_at", "registered_at2"), ), } resource.Test( diff --git a/fivetran/framework/resources/local_processing_agent_test.go b/fivetran/framework/resources/local_processing_agent_test.go index 97a804bb..c28db858 100644 --- a/fivetran/framework/resources/local_processing_agent_test.go +++ b/fivetran/framework/resources/local_processing_agent_test.go @@ -31,20 +31,20 @@ func setupMockClientLocalProcessingAgentResource(t *testing.T) { } }` - localProcessingAgentPostHandler = tfmock.MockClient().When(http.MethodPost, "/v1/local-processing-agents").ThenCall( + localProcessingAgentPostHandler = tfmock.MockClient().When(http.MethodPost, "/v1/hybrid-deployment-agents").ThenCall( func(req *http.Request) (*http.Response, error) { localProcessingAgentData = tfmock.CreateMapFromJsonString(t, localProcessingAgentResponse) return tfmock.FivetranSuccessResponse(t, req, http.StatusCreated, "Local Processing Agent has been created", localProcessingAgentData), nil }, ) - tfmock.MockClient().When(http.MethodGet, "/v1/local-processing-agents/lpa_id").ThenCall( + tfmock.MockClient().When(http.MethodGet, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( func(req *http.Request) (*http.Response, error) { return tfmock.FivetranSuccessResponse(t, req, http.StatusOK, "", localProcessingAgentData), nil }, ) - localProcessingAgentDeleteHandler = tfmock.MockClient().When(http.MethodDelete, "/v1/local-processing-agents/lpa_id").ThenCall( + localProcessingAgentDeleteHandler = tfmock.MockClient().When(http.MethodDelete, "/v1/hybrid-deployment-agents/lpa_id").ThenCall( func(req *http.Request) (*http.Response, error) { return tfmock.FivetranSuccessResponse(t, req, 200, "Local Processing Agent has been deleted", nil), nil }, From 68afdc408da45cc673f0ac6cf03ef37327094faa Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Mon, 4 Nov 2024 10:43:44 +0100 Subject: [PATCH 18/21] fix tests --- fivetran/tests/e2e/fivetran_test.go | 3 + fivetran/tests/e2e/resource_group_e2e_test.go | 169 +++++++++--------- .../e2e/resource_private_link_e2e_test.go | 10 +- 3 files changed, 86 insertions(+), 96 deletions(-) diff --git a/fivetran/tests/e2e/fivetran_test.go b/fivetran/tests/e2e/fivetran_test.go index 30239de5..e06c7500 100644 --- a/fivetran/tests/e2e/fivetran_test.go +++ b/fivetran/tests/e2e/fivetran_test.go @@ -5,6 +5,8 @@ import ( "log" "os" "testing" + "math/rand" + "time" gofivetran "github.com/fivetran/go-fivetran" "github.com/fivetran/terraform-provider-fivetran/fivetran/framework" @@ -26,6 +28,7 @@ const ( var testProvioderFramework provider.Provider var client *gofivetran.Client +var seededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano())) var ProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){ "fivetran-provider": func() (tfprotov6.ProviderServer, error) { diff --git a/fivetran/tests/e2e/resource_group_e2e_test.go b/fivetran/tests/e2e/resource_group_e2e_test.go index 610f75f2..ad23d020 100644 --- a/fivetran/tests/e2e/resource_group_e2e_test.go +++ b/fivetran/tests/e2e/resource_group_e2e_test.go @@ -12,55 +12,16 @@ import ( "github.com/hashicorp/terraform-plugin-testing/terraform" ) -func TestResourceGroupE2E(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() {}, - ProtoV6ProviderFactories: ProtoV6ProviderFactories, - CheckDestroy: testFivetranGroupResourceDestroy, - Steps: []resource.TestStep{ - { - Config: ` +var groupResourceConfig = ` resource "fivetran_group" "testgroup" { provider = fivetran-provider - name = "TestResourceGroupE2E" - } - `, - Check: resource.ComposeAggregateTestCheckFunc( - testFivetranGroupResourceCreate(t, "fivetran_group.testgroup"), - resource.TestCheckResourceAttr("fivetran_group.testgroup", "name", "TestResourceGroupE2E"), - resource.TestCheckResourceAttrSet("fivetran_group.testgroup", "created_at"), - ), - }, - { - Config: ` - resource "fivetran_group" "testgroup" { - provider = fivetran-provider - name = "TestResourceGroupE2E_updated" - } - `, - Check: resource.ComposeAggregateTestCheckFunc( - testFivetranGroupResourceUpdate(t, "fivetran_group.testgroup"), - resource.TestCheckResourceAttr("fivetran_group.testgroup", "name", "TestResourceGroupE2E_updated"), - resource.TestCheckResourceAttrSet("fivetran_group.testgroup", "created_at"), - resource.TestCheckResourceAttrSet("fivetran_group.testgroup", "last_updated"), - ), - }, - }, - }) -} + name = "%v" + }` -func TestResourceGroupWithUsersE2E(t *testing.T) { - //t.Skip("Endpoint to add user to group doesn't support new RBAC role names. It will be fixed soon") - resource.Test(t, resource.TestCase{ - PreCheck: func() {}, - ProtoV6ProviderFactories: ProtoV6ProviderFactories, - CheckDestroy: testFivetranGroupResourceDestroy, - Steps: []resource.TestStep{ - { - Config: ` +var groupResourceWithUsersConfig = ` resource "fivetran_user" "userjohn" { provider = fivetran-provider - email = "john.black@testmail.com" + email = "%v" family_name = "Black" given_name = "John" phone = "+19876543210" @@ -70,7 +31,7 @@ func TestResourceGroupWithUsersE2E(t *testing.T) { resource "fivetran_group" "testgroup" { provider = fivetran-provider - name = "TestResourceGroupWithUsersE2E" + name = "%v" } resource "fivetran_group_users" "testgroup_users" { @@ -79,21 +40,15 @@ func TestResourceGroupWithUsersE2E(t *testing.T) { user { email = fivetran_user.userjohn.email - role = "Destination Reviewer" + role = "%v" } } - `, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrSet("fivetran_group_users.testgroup_users", "user.0.id"), - resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.role", "Destination Reviewer"), - resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.email", "john.black@testmail.com"), - ), - }, - { - Config: ` + ` + +var groupResourceWithEmptyUsersConfig = ` resource "fivetran_user" "userjohn" { provider = fivetran-provider - email = "john.black@testmail.com" + email = "%v" family_name = "Black" given_name = "John" phone = "+19876543210" @@ -103,49 +58,85 @@ func TestResourceGroupWithUsersE2E(t *testing.T) { resource "fivetran_group" "testgroup" { provider = fivetran-provider - name = "TestResourceGroupWithUsersE2E" + name = "%v" } resource "fivetran_group_users" "testgroup_users" { provider = fivetran-provider group_id = fivetran_group.testgroup.id - - user { - email = fivetran_user.userjohn.email - role = "Destination Administrator" - } } - `, + ` + +func TestResourceGroupE2E(t *testing.T) { + suffix := strconv.Itoa(seededRand.Int()) + groupCreateName := "TestResourceGroupE2E" + suffix + "created" + groupUpdateName := "TestResourceGroupE2E" + suffix + "updated" + + resourceCreateConfig := fmt.Sprintf(groupResourceConfig, groupCreateName) + resourceUpdateConfig := fmt.Sprintf(groupResourceConfig, groupUpdateName) + + resource.Test(t, resource.TestCase{ + PreCheck: func() {}, + ProtoV6ProviderFactories: ProtoV6ProviderFactories, + CheckDestroy: testFivetranGroupResourceDestroy, + Steps: []resource.TestStep{ + { + Config: resourceCreateConfig, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrSet("fivetran_group_users.testgroup_users", "user.0.id"), - resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.role", "Destination Administrator"), - resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.email", "john.black@testmail.com"), + testFivetranGroupResourceCreate(t, "fivetran_group.testgroup"), + resource.TestCheckResourceAttr("fivetran_group.testgroup", "name", groupCreateName), + resource.TestCheckResourceAttrSet("fivetran_group.testgroup", "created_at"), ), }, { - Config: ` - resource "fivetran_user" "userjohn" { - provider = fivetran-provider - email = "john.black@testmail.com" - family_name = "Black" - given_name = "John" - phone = "+19876543210" - picture = "https://myPicturecom" - role = "Account Reviewer" - } + Config: resourceUpdateConfig, + Check: resource.ComposeAggregateTestCheckFunc( + testFivetranGroupResourceUpdate(t, "fivetran_group.testgroup", groupUpdateName), + resource.TestCheckResourceAttr("fivetran_group.testgroup", "name", groupUpdateName), + resource.TestCheckResourceAttrSet("fivetran_group.testgroup", "created_at"), + resource.TestCheckResourceAttrSet("fivetran_group.testgroup", "last_updated"), + ), + }, + }, + }) +} - resource "fivetran_group" "testgroup" { - provider = fivetran-provider - name = "TestResourceGroupWithUsersE2E" - } +func TestResourceGroupWithUsersE2E(t *testing.T) { + suffix := strconv.Itoa(seededRand.Int()) + groupName := "TestResourceGroupE2E" + suffix + "created" + userName := "john.black" + suffix + "@testmail.com" + roleCreate := "Destination Reviewer" + roleUpdate := "Destination Administrator" - resource "fivetran_group_users" "testgroup_users" { - provider = fivetran-provider - group_id = fivetran_group.testgroup.id - } - `, + resourceWithUsersCreateConfig := fmt.Sprintf(groupResourceWithUsersConfig, userName, groupName, roleCreate) + resourceWithUsersUpdateConfig := fmt.Sprintf(groupResourceWithUsersConfig, userName, groupName, roleUpdate) + resourceWithUsersEmptyConfig := fmt.Sprintf(groupResourceWithEmptyUsersConfig, userName, groupName) + + resource.Test(t, resource.TestCase{ + PreCheck: func() {}, + ProtoV6ProviderFactories: ProtoV6ProviderFactories, + CheckDestroy: testFivetranGroupResourceDestroy, + Steps: []resource.TestStep{ + { + Config: resourceWithUsersCreateConfig, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet("fivetran_group_users.testgroup_users", "user.0.id"), + resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.role", roleCreate), + resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.email", userName), + ), + }, + { + Config: resourceWithUsersUpdateConfig, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet("fivetran_group_users.testgroup_users", "user.0.id"), + resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.role", roleUpdate), + resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.0.email", userName), + ), + }, + { + Config: resourceWithUsersEmptyConfig, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("fivetran_group.testgroup", "name", "TestResourceGroupWithUsersE2E"), + resource.TestCheckResourceAttr("fivetran_group.testgroup", "name", groupName), resource.TestCheckResourceAttr("fivetran_group_users.testgroup_users", "user.#", "0"), ), }, @@ -153,7 +144,7 @@ func TestResourceGroupWithUsersE2E(t *testing.T) { }) } -func testFivetranGroupResourceUpdate(t *testing.T, resourceName string) resource.TestCheckFunc { +func testFivetranGroupResourceUpdate(t *testing.T, resourceName string, groupName string) resource.TestCheckFunc { return func(s *terraform.State) error { rs := GetResource(t, s, resourceName) response, err := client.NewGroupDetails().GroupID(rs.Primary.ID).Do(context.Background()) @@ -162,8 +153,8 @@ func testFivetranGroupResourceUpdate(t *testing.T, resourceName string) resource return err } - if response.Data.Name != "TestResourceGroupE2E_updated" { - return fmt.Errorf("Group has name %v different from expected (%v)", response.Data.Name, "TestResourceGroupE2E_updated") + if response.Data.Name != groupName { + return fmt.Errorf("Group has name %v different from expected (%v)", response.Data.Name, groupName) } return nil diff --git a/fivetran/tests/e2e/resource_private_link_e2e_test.go b/fivetran/tests/e2e/resource_private_link_e2e_test.go index 04e963d3..8eba21f3 100644 --- a/fivetran/tests/e2e/resource_private_link_e2e_test.go +++ b/fivetran/tests/e2e/resource_private_link_e2e_test.go @@ -5,14 +5,12 @@ import ( "fmt" "strconv" "testing" - "math/rand" - "time" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" ) -var resourceConfig = ` +var privateLinkResourceConfig = ` resource "fivetran_private_link" "test_pl" { provider = fivetran-provider @@ -26,15 +24,13 @@ var resourceConfig = ` } }` -var seededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano())) - func TestResourcePrivateLinkE2E(t *testing.T) { - t.Skip("Private links have a strict limit on the number of entities created. This test should only be used for intermediate tests when changes are made directly to Private links.") + //t.Skip("Private links have a strict limit on the number of entities created. This test should only be used for intermediate tests when changes are made directly to Private links.") suffix := strconv.Itoa(seededRand.Int()) privateLinkName := suffix privateLinkCfgValue := "privatelink_" + suffix - resourceConfig = fmt.Sprintf(resourceConfig, privateLinkName, privateLinkCfgValue, privateLinkCfgValue) + resourceConfig := fmt.Sprintf(privateLinkResourceConfig, privateLinkName, privateLinkCfgValue, privateLinkCfgValue) resource.Test(t, resource.TestCase{ PreCheck: func() {}, From 4f3cf036e3a01fd2b0bf0cad4e61199378f972f9 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Tue, 5 Nov 2024 16:49:44 +0100 Subject: [PATCH 19/21] fix tests --- CHANGELOG.md | 4 ++-- go.mod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3140394e..82fec0fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.4.0...HEAD) +## [Unreleased](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.4.1...HEAD) -## [1.4.0](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.3.2...v1.4.0) +## [1.4.1](https://github.com/fivetran/terraform-provider-fivetran/compare/v1.4.0...v1.4.1) ## Added - New resource `fivetran_private_link` that allows to manage Private Links. diff --git a/go.mod b/go.mod index 91ae5a9b..23f53bac 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/fivetran/terraform-provider-fivetran require ( - github.com/fivetran/go-fivetran v1.0.3 + github.com/fivetran/go-fivetran v1.0.4 github.com/hashicorp/terraform-plugin-framework v1.8.0 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 From 01753328e6dc1812f2787f7a3d0289cab5c0fe4f Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Tue, 5 Nov 2024 16:55:35 +0100 Subject: [PATCH 20/21] fix build --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index 440b062e..fd5b7121 100644 --- a/go.sum +++ b/go.sum @@ -17,6 +17,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fivetran/go-fivetran v1.0.3 h1:1x/lmuvvQj7DPICoMZDi8bQitgtDm767SJ3to5RYwD8= github.com/fivetran/go-fivetran v1.0.3/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= +github.com/fivetran/go-fivetran v1.0.4 h1:wYNS72Zw/bEZpuBKFYGm07TRQtqoo1/Y6oWayHAqEHk= +github.com/fivetran/go-fivetran v1.0.4/go.mod h1:EIy5Uwn1zylQCr/7O+8rrwvmjvhW3PPpzHkQj26ON7Y= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= From e5ee85b207d60ac6a9ee8d6c780d1ca90f888246 Mon Sep 17 00:00:00 2001 From: Aleksandr Boldyrev Date: Tue, 5 Nov 2024 23:03:41 +0100 Subject: [PATCH 21/21] using custom map --- docs/data-sources/private_link.md | 24 +--- docs/resources/connector_schema_config.md | 1 - docs/resources/private_link.md | 35 ++--- fivetran/framework/core/model/private_link.go | 81 +----------- .../framework/core/schema/private_link.go | 120 ++++-------------- .../datasources/private_link_test.go | 2 +- fivetran/framework/resources/private_link.go | 10 +- .../framework/resources/private_link_test.go | 10 +- .../e2e/resource_private_link_e2e_test.go | 6 +- 9 files changed, 59 insertions(+), 230 deletions(-) diff --git a/docs/data-sources/private_link.md b/docs/data-sources/private_link.md index 8788b99f..6b5edf9a 100644 --- a/docs/data-sources/private_link.md +++ b/docs/data-sources/private_link.md @@ -21,34 +21,14 @@ data "fivetran_private_link" "private_link" { - `id` (String) The unique identifier for the private link within the Fivetran system. -### Optional - -- `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) - ### Read-Only - `cloud_provider` (String) The cloud provider name. +- `config_map` (Map of String) Configuration. - `created_at` (String) The date and time the membership was created. - `created_by` (String) The unique identifier for the User within the Fivetran system. - `name` (String) The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters. - `region` (String) Data processing location. This is where Fivetran will operate and run computation on data. - `service` (String) Service type. - `state` (String) The state of the private link. -- `state_summary` (String) The state of the private link. - - -### Nested Schema for `config` - -Optional: - -- `account_url` (String) The URL of your account. -- `aws_account_id` (String) The ID of your AWS account. -- `cluster_identifier` (String) The cluster identifier. -- `connection_service_id` (String) The ID of your connection service. -- `connection_service_name` (String) The name of your connection service. -- `pls_id` (String) The ID of your Azure Private Link service. -- `private_connection_service_id` (String) The ID of your connection service. -- `private_dns_regions` (String) Private DNS Regions. -- `sub_resource_name` (String) The name of subresource. -- `vpce_id` (String) The ID of your Virtual Private Cloud Endpoint. -- `workspace_url` (String) The URL of your workspace. \ No newline at end of file +- `state_summary` (String) The state of the private link. \ No newline at end of file diff --git a/docs/resources/connector_schema_config.md b/docs/resources/connector_schema_config.md index 190300ee..ddcfa775 100644 --- a/docs/resources/connector_schema_config.md +++ b/docs/resources/connector_schema_config.md @@ -182,7 +182,6 @@ resource "fivetran_connector_schema_config" "schema" { ### Optional -- `schema_change_handling` (String) The value specifying how new source data is handled. - `schema` (Block Set, Deprecated) (see [below for nested schema](#nestedblock--schema)) - `schema_change_handling` (String) The value specifying how new source data is handled. - `schemas` (Attributes Map) Map of schema configurations. (see [below for nested schema](#nestedatt--schemas)) diff --git a/docs/resources/private_link.md b/docs/resources/private_link.md index 3b2f9dd8..8e11cca7 100644 --- a/docs/resources/private_link.md +++ b/docs/resources/private_link.md @@ -27,14 +27,24 @@ resource "fivetran_private_link" "test_pl" { ### Required +- `config_map` (Map of String) Configuration. + +#### Possible values +-- `connection_service_name` (String): The name of your connection service. +-- `account_url` (String): The URL of your account. +-- `vpce_id` (String): The ID of your Virtual Private Cloud Endpoint. +-- `aws_account_id` (String): The ID of your AWS account. +-- `cluster_identifier` (String): The cluster identifier. +-- `connection_service_id` (String): The ID of your connection service. +-- `workspace_url` (String): The URL of your workspace. +-- `pls_id` (String): The ID of your Azure Private Link service. +-- `sub_resource_name` (String): The name of subresource. +-- `private_dns_regions` (String): Private DNS Regions. +-- `private_connection_service_id` (String): The ID of your connection service. - `name` (String) The private link name within the account. The name must start with a letter or underscore and can only contain letters, numbers, or underscores. Maximum size of name is 23 characters. - `region` (String) Data processing location. This is where Fivetran will operate and run computation on data. - `service` (String) Service type. -### Optional - -- `config` (Block, Optional) (see [below for nested schema](#nestedblock--config)) - ### Read-Only - `cloud_provider` (String) The cloud provider name. @@ -43,20 +53,3 @@ resource "fivetran_private_link" "test_pl" { - `id` (String) The unique identifier for the private link within the Fivetran system. - `state` (String) The state of the private link. - `state_summary` (String) The state of the private link. - - -### Nested Schema for `config` - -Optional: - -- `account_url` (String) The URL of your account. -- `aws_account_id` (String) The ID of your AWS account. -- `cluster_identifier` (String) The cluster identifier. -- `connection_service_id` (String) The ID of your connection service. -- `connection_service_name` (String) The name of your connection service. -- `pls_id` (String) The ID of your Azure Private Link service. -- `private_connection_service_id` (String) The ID of your connection service. -- `private_dns_regions` (String) Private DNS Regions. -- `sub_resource_name` (String) The name of subresource. -- `vpce_id` (String) The ID of your Virtual Private Cloud Endpoint. -- `workspace_url` (String) The URL of your workspace. diff --git a/fivetran/framework/core/model/private_link.go b/fivetran/framework/core/model/private_link.go index bdc50e4b..ab8e0141 100644 --- a/fivetran/framework/core/model/private_link.go +++ b/fivetran/framework/core/model/private_link.go @@ -19,8 +19,7 @@ type PrivateLink struct { StateSummary types.String `tfsdk:"state_summary"` CreatedAt types.String `tfsdk:"created_at"` CreatedBy types.String `tfsdk:"created_by"` - - Config types.Object `tfsdk:"config"` + ConfigMap types.Map `tfsdk:"config_map"` } var PrivateLinkConfigType = map[string]attr.Type{ @@ -116,7 +115,7 @@ func (d *PrivateLink) ReadFromResponse(ctx context.Context, resp privatelink.Pri config["private_connection_service_id"] = types.StringNull() } - d.Config, _ = types.ObjectValue(PrivateLinkConfigType, config) + d.ConfigMap, _ = types.MapValue(types.StringType, config) } func (d *PrivateLink) ReadFromCustomResponse(ctx context.Context, resp privatelink.PrivateLinkCustomResponse) { @@ -131,81 +130,15 @@ func (d *PrivateLink) ReadFromCustomResponse(ctx context.Context, resp privateli d.CreatedBy = types.StringValue(resp.Data.CreatedBy) config := map[string]attr.Value{} - - if resp.Data.Config["connection_service_name"] != nil && resp.Data.Config["connection_service_name"] != "" { - config["connection_service_name"] = types.StringValue(resp.Data.Config["connection_service_name"].(string)) - } else { - config["connection_service_name"] = types.StringNull() - } - - if resp.Data.Config["account_url"] != nil && resp.Data.Config["account_url"] != "" { - config["account_url"] = types.StringValue(resp.Data.Config["account_url"].(string)) - } else { - config["account_url"] = types.StringNull() + for k, v := range resp.Data.Config { + config[k] = types.StringValue(v.(string)) } - - if resp.Data.Config["vpce_id"] != nil && resp.Data.Config["vpce_id"] != "" { - config["vpce_id"] = types.StringValue(resp.Data.Config["vpce_id"].(string)) - } else { - config["vpce_id"] = types.StringNull() - } - - if resp.Data.Config["aws_account_id"] != nil && resp.Data.Config["aws_account_id"] != "" { - config["aws_account_id"] = types.StringValue(resp.Data.Config["aws_account_id"].(string)) - } else { - config["aws_account_id"] = types.StringNull() - } - - if resp.Data.Config["cluster_identifier"] != nil && resp.Data.Config["cluster_identifier"] != "" { - config["cluster_identifier"] = types.StringValue(resp.Data.Config["cluster_identifier"].(string)) - } else { - config["cluster_identifier"] = types.StringNull() - } - - if resp.Data.Config["connection_service_id"] != nil && resp.Data.Config["connection_service_id"] != "" { - config["connection_service_id"] = types.StringValue(resp.Data.Config["connection_service_id"].(string)) - } else { - config["connection_service_id"] = types.StringNull() - } - - if resp.Data.Config["workspace_url"] != nil && resp.Data.Config["workspace_url"] != "" { - config["workspace_url"] = types.StringValue(resp.Data.Config["workspace_url"].(string)) - } else { - config["workspace_url"] = types.StringNull() - } - - if resp.Data.Config["pls_id"] != nil && resp.Data.Config["pls_id"] != "" { - config["pls_id"] = types.StringValue(resp.Data.Config["pls_id"].(string)) - } else { - config["pls_id"] = types.StringNull() - } - - if resp.Data.Config["sub_resource_name"] != nil && resp.Data.Config["sub_resource_name"] != "" { - config["sub_resource_name"] = types.StringValue(resp.Data.Config["sub_resource_name"].(string)) - } else { - config["sub_resource_name"] = types.StringNull() - } - - if resp.Data.Config["private_dns_regions"] != nil && resp.Data.Config["private_dns_regions"] != "" { - config["private_dns_regions"] = types.StringValue(resp.Data.Config["private_dns_regions"].(string)) - } else { - config["private_dns_regions"] = types.StringNull() - } - - if resp.Data.Config["private_connection_service_id"] != nil { - config["private_connection_service_id"] = types.BoolValue(resp.Data.Config["private_connection_service_id"].(bool)) - } else { - config["private_connection_service_id"] = types.BoolValue(false) - } - - d.Config, _ = types.ObjectValue(PrivateLinkConfigType, config) + d.ConfigMap, _ = types.MapValue(types.StringType, config) } -func (d *PrivateLink) GetConfig() map[string]interface{} { - attr := d.Config.Attributes() - +func (d *PrivateLink) GetConfigMap() map[string]interface{} { config := make(map[string]interface{}) - for k, v := range attr{ + for k, v := range d.ConfigMap.Elements(){ if !v.IsUnknown() && !v.IsNull() { if t, ok := v.(basetypes.Int64Value); ok { config[k] = t.ValueInt64() diff --git a/fivetran/framework/core/schema/private_link.go b/fivetran/framework/core/schema/private_link.go index 6676ba19..8fe425b7 100644 --- a/fivetran/framework/core/schema/private_link.go +++ b/fivetran/framework/core/schema/private_link.go @@ -3,6 +3,7 @@ package schema import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema" datasourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" ) @@ -49,55 +50,23 @@ func PrivateLinkResource() resourceSchema.Schema { Computed: true, Description: "The unique identifier for the User within the Fivetran system.", }, - }, - Blocks: map[string]resourceSchema.Block{ - "config": resourceSchema.SingleNestedBlock{ - Attributes: map[string]resourceSchema.Attribute{ - "connection_service_name": resourceSchema.StringAttribute{ - Optional: true, - Description: "The name of your connection service.", - }, - "account_url": resourceSchema.StringAttribute{ - Optional: true, - Description: "The URL of your account.", - }, - "vpce_id": resourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your Virtual Private Cloud Endpoint.", - }, - "aws_account_id": resourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your AWS account.", - }, - "cluster_identifier": resourceSchema.StringAttribute{ - Optional: true, - Description: "The cluster identifier.", - }, - "connection_service_id": resourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your connection service.", - }, - "workspace_url": resourceSchema.StringAttribute{ - Optional: true, - Description: "The URL of your workspace.", - }, - "pls_id": resourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your Azure Private Link service.", - }, - "sub_resource_name": resourceSchema.StringAttribute{ - Optional: true, - Description: "The name of subresource.", - }, - "private_dns_regions": resourceSchema.StringAttribute{ - Optional: true, - Description: "Private DNS Regions.", - }, - "private_connection_service_id": resourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your connection service.", - }, - }, + "config_map": resourceSchema.MapAttribute{ + ElementType: types.StringType, + Required: true, + MarkdownDescription: `Configuration. + +#### Possible values +-- ` + "`connection_service_name` (String)" + `: The name of your connection service. +-- ` + "`account_url` (String)" + `: The URL of your account. +-- ` + "`vpce_id` (String)" + `: The ID of your Virtual Private Cloud Endpoint. +-- ` + "`aws_account_id` (String)" + `: The ID of your AWS account. +-- ` + "`cluster_identifier` (String)" + `: The cluster identifier. +-- ` + "`connection_service_id` (String)" + `: The ID of your connection service. +-- ` + "`workspace_url` (String)" + `: The URL of your workspace. +-- ` + "`pls_id` (String)" + `: The ID of your Azure Private Link service. +-- ` + "`sub_resource_name` (String)" + `: The name of subresource. +-- ` + "`private_dns_regions` (String)" + `: Private DNS Regions. +-- ` + "`private_connection_service_id` (String)" + `: The ID of your connection service.`, }, }, } @@ -142,55 +111,10 @@ func PrivateLinkDatasource() datasourceSchema.Schema { Computed: true, Description: "The unique identifier for the User within the Fivetran system.", }, - }, - Blocks: map[string]datasourceSchema.Block{ - "config": datasourceSchema.SingleNestedBlock{ - Attributes: map[string]datasourceSchema.Attribute{ - "connection_service_name": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The name of your connection service.", - }, - "account_url": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The URL of your account.", - }, - "vpce_id": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your Virtual Private Cloud Endpoint.", - }, - "aws_account_id": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your AWS account.", - }, - "cluster_identifier": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The cluster identifier.", - }, - "connection_service_id": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your connection service.", - }, - "workspace_url": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The URL of your workspace.", - }, - "pls_id": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your Azure Private Link service.", - }, - "sub_resource_name": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The name of subresource.", - }, - "private_dns_regions": datasourceSchema.StringAttribute{ - Optional: true, - Description: "Private DNS Regions.", - }, - "private_connection_service_id": datasourceSchema.StringAttribute{ - Optional: true, - Description: "The ID of your connection service.", - }, - }, + "config_map": resourceSchema.MapAttribute{ + ElementType: types.StringType, + Computed: true, + MarkdownDescription: `Configuration.`, }, }, } diff --git a/fivetran/framework/datasources/private_link_test.go b/fivetran/framework/datasources/private_link_test.go index 40ebbda0..4b842aea 100644 --- a/fivetran/framework/datasources/private_link_test.go +++ b/fivetran/framework/datasources/private_link_test.go @@ -70,7 +70,7 @@ func TestDataSourcePrivateLinkConfigMappingMock(t *testing.T) { resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "created_at", "created_at"), resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "created_by", "created_by"), - resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "config.connection_service_name", "connection_service_name"), + resource.TestCheckResourceAttr("data.fivetran_private_link.test_pl", "config_map.connection_service_name", "connection_service_name"), ), } diff --git a/fivetran/framework/resources/private_link.go b/fivetran/framework/resources/private_link.go index 036df225..47b97fd2 100644 --- a/fivetran/framework/resources/private_link.go +++ b/fivetran/framework/resources/private_link.go @@ -59,8 +59,8 @@ func (r *privateLink) Create(ctx context.Context, req resource.CreateRequest, re svc.Service(data.Service.ValueString()) svc.Name(data.Name.ValueString()) - config := data.GetConfig() - svc.ConfigCustom(&config) + configMap := data.GetConfigMap() + svc.ConfigCustom(&configMap) createResponse, err := svc.DoCustom(ctx) if err != nil { @@ -118,9 +118,9 @@ func (r *privateLink) Update(ctx context.Context, req resource.UpdateRequest, re svc := r.GetClient().NewPrivateLinkModify().PrivateLinkId(state.Id.ValueString()) - if !plan.Config.Equal(state.Config) { - config := plan.GetConfig() - svc.ConfigCustom(&config) + if !plan.ConfigMap.Equal(state.ConfigMap) { + configMap := plan.GetConfigMap() + svc.ConfigCustom(&configMap) hasChanges = true } diff --git a/fivetran/framework/resources/private_link_test.go b/fivetran/framework/resources/private_link_test.go index 4fd931e9..5310a3d5 100644 --- a/fivetran/framework/resources/private_link_test.go +++ b/fivetran/framework/resources/private_link_test.go @@ -32,7 +32,7 @@ func setupMockClientPrivateLinkResource(t *testing.T) { "created_at": "created_at", "created_by": "created_by", "config": { - "connection_service_name": "connection_service_name" + "connection_service_name": "connection_service_name" } }` @@ -67,9 +67,9 @@ func TestResourcePrivateLinkMock(t *testing.T) { region = "region" service = "service" - config { - connection_service_name = "connection_service_name" - } + config_map = { + connection_service_name = "connection_service_name" + } }`, Check: resource.ComposeAggregateTestCheckFunc( @@ -80,7 +80,7 @@ func TestResourcePrivateLinkMock(t *testing.T) { resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "name", "name"), resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "region", "region"), resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "service", "service"), - resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config.connection_service_name", "connection_service_name"), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config_map.connection_service_name", "connection_service_name"), ), } diff --git a/fivetran/tests/e2e/resource_private_link_e2e_test.go b/fivetran/tests/e2e/resource_private_link_e2e_test.go index 8eba21f3..4b362e98 100644 --- a/fivetran/tests/e2e/resource_private_link_e2e_test.go +++ b/fivetran/tests/e2e/resource_private_link_e2e_test.go @@ -18,7 +18,7 @@ var privateLinkResourceConfig = ` region = "AWS_US_EAST_1" service = "REDSHIFT_AWS" - config { + config_map = { aws_account_id = "%v" cluster_identifier = "%v" } @@ -43,8 +43,8 @@ func TestResourcePrivateLinkE2E(t *testing.T) { resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "name", privateLinkName), resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "region", "AWS_US_EAST_1"), resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "service", "REDSHIFT_AWS"), - resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config.aws_account_id", privateLinkCfgValue), - resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config.cluster_identifier", privateLinkCfgValue), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config_map.aws_account_id", privateLinkCfgValue), + resource.TestCheckResourceAttr("fivetran_private_link.test_pl", "config_map.cluster_identifier", privateLinkCfgValue), ), }, },