From 2abf096f5e16a6647e49292d17c2b981c92ecd72 Mon Sep 17 00:00:00 2001 From: Joe Andaverde Date: Mon, 12 Apr 2021 18:15:32 -0500 Subject: [PATCH 1/2] go fmt --- internal/provider/data_source_available_regions.go | 7 +++---- internal/provider/provider.go | 12 ++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/internal/provider/data_source_available_regions.go b/internal/provider/data_source_available_regions.go index 5470e11..68ce562 100644 --- a/internal/provider/data_source_available_regions.go +++ b/internal/provider/data_source_available_regions.go @@ -71,11 +71,10 @@ func dataSourceRegionsRead(ctx context.Context, d *schema.ResourceData, meta int return nil } - func flattenRegion(region *astra.AvailableRegionCombination) map[string]interface{} { return map[string]interface{}{ "cloud_provider": region.CloudProvider, - "region": region.Region, - "tier":region.Tier, + "region": region.Region, + "tier": region.Tier, } -} \ No newline at end of file +} diff --git a/internal/provider/provider.go b/internal/provider/provider.go index cde981e..23c5e03 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -31,12 +31,12 @@ func New(version string) func() *schema.Provider { return func() *schema.Provider { p := &schema.Provider{ DataSourcesMap: map[string]*schema.Resource{ - "astra_database": dataSourceDatabase(), - "astra_databases": dataSourceDatabases(), - "astra_keyspace": dataSourceKeyspace(), - "astra_keyspaces": dataSourceKeyspaces(), - "astra_secure_connect_bundle_url": dataSourceSecureConnectBundleURL(), - "astra_data_source_available_regions": dataSourceAvailableRegions(), + "astra_database": dataSourceDatabase(), + "astra_databases": dataSourceDatabases(), + "astra_keyspace": dataSourceKeyspace(), + "astra_keyspaces": dataSourceKeyspaces(), + "astra_secure_connect_bundle_url": dataSourceSecureConnectBundleURL(), + "astra_data_source_available_regions": dataSourceAvailableRegions(), }, ResourcesMap: map[string]*schema.Resource{ "astra_database": resourceDatabase(), From 517548cd7b203cbad9e13225e0560c5071b6dbec Mon Sep 17 00:00:00 2001 From: Joe Andaverde Date: Mon, 12 Apr 2021 18:19:23 -0500 Subject: [PATCH 2/2] regenerate docs. terraform fmt --- .../data_source_available_regions.md | 35 +++++++++++++++++++ docs/data-sources/database.md | 32 ++++++++--------- .../resources/existing_databases/resource.tf | 2 +- .../resource.tf | 4 +-- 4 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 docs/data-sources/data_source_available_regions.md diff --git a/docs/data-sources/data_source_available_regions.md b/docs/data-sources/data_source_available_regions.md new file mode 100644 index 0000000..01d9032 --- /dev/null +++ b/docs/data-sources/data_source_available_regions.md @@ -0,0 +1,35 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "astra_data_source_available_regions Data Source - terraform-provider-astra" +subcategory: "" +description: |- + Retrieve a list of available cloud regions in Astra +--- + +# astra_data_source_available_regions (Data Source) + +Retrieve a list of available cloud regions in Astra + + + + +## Schema + +### Optional + +- **id** (String) The ID of this resource. + +### Read-Only + +- **results** (List of Object) The list of supported Astra regions by cloud provider and tier. (see [below for nested schema](#nestedatt--results)) + + +### Nested Schema for `results` + +Read-Only: + +- **cloud_provider** (String) +- **region** (String) +- **tier** (String) + + diff --git a/docs/data-sources/database.md b/docs/data-sources/database.md index e14a0d1..84acdd5 100644 --- a/docs/data-sources/database.md +++ b/docs/data-sources/database.md @@ -17,7 +17,7 @@ Datasource for Astra database. ### Required -- **database_id** (String) The ID of the Astra database. +- **database_id** (String) Astra Database ID (system generated) ### Optional @@ -25,20 +25,20 @@ Datasource for Astra database. ### Read-Only -- **additional_keyspaces** (List of String) The total_storage -- **cloud_provider** (String) The cloud provider -- **cqlsh_url** (String) The cqlsh_url -- **data_endpoint_url** (String) The data_endpoint_url -- **grafana_url** (String) The grafana_url -- **graphql_url** (String) The graphql_url -- **keyspace** (String) The keyspace -- **name** (String) The database name. -- **node_count** (Number) The node_count -- **organization_id** (String) The org id. -- **owner_id** (String) The owner id. -- **region** (String) The cloud provider region -- **replication_factor** (Number) The replication_factor -- **status** (String) The status -- **total_storage** (Number) The total_storage +- **additional_keyspaces** (List of String) Additional keyspaces +- **cloud_provider** (String) Cloud provider (AWS, GCP, AZURE) +- **cqlsh_url** (String) URL for cqlsh web +- **data_endpoint_url** (String) REST API URL +- **grafana_url** (String) URL for the grafana dashboard for this database +- **graphql_url** (String) Graphql URL +- **keyspace** (String) Initial keyspace +- **name** (String) Database name (user provided) +- **node_count** (Number) Node count (not relevant for serverless databases) +- **organization_id** (String) Ordg id (system generated) +- **owner_id** (String) Owner id (system generated) +- **region** (String) Cloud provider region. Get list of supported regions from regions data-source +- **replication_factor** (Number) Replication Factor (not relevant for serverless databases) +- **status** (String) Database status +- **total_storage** (Number) Storage Capacity (not relevant for serverelss databases) diff --git a/examples/resources/existing_databases/resource.tf b/examples/resources/existing_databases/resource.tf index 106cac8..b047ef3 100644 --- a/examples/resources/existing_databases/resource.tf +++ b/examples/resources/existing_databases/resource.tf @@ -1,5 +1,5 @@ data "astra_databases" "databaselist" { - status = "ACTIVE" + status = "ACTIVE" } output "existing_dbs" { diff --git a/examples/resources/scbs_from _existing_astra_databases/resource.tf b/examples/resources/scbs_from _existing_astra_databases/resource.tf index 982be75..0168593 100644 --- a/examples/resources/scbs_from _existing_astra_databases/resource.tf +++ b/examples/resources/scbs_from _existing_astra_databases/resource.tf @@ -1,5 +1,5 @@ data "astra_databases" "databaselist" { - status = "ACTIVE" + status = "ACTIVE" } locals { @@ -7,6 +7,6 @@ locals { } data "astra_secure_connect_bundle_url" "dev" { - for_each = toset(local.dbs) + for_each = toset(local.dbs) database_id = each.value } \ No newline at end of file