Skip to content

Commit

Permalink
Merge branch 'main' of github.com:datastax/terraform-provider-astra i…
Browse files Browse the repository at this point in the history
…nto main
  • Loading branch information
phact committed Apr 13, 2021
2 parents b208feb + 80a2515 commit 8055b7f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 29 deletions.
35 changes: 35 additions & 0 deletions docs/data-sources/data_source_available_regions.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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))

<a id="nestedatt--results"></a>
### Nested Schema for `results`

Read-Only:

- **cloud_provider** (String)
- **region** (String)
- **tier** (String)


32 changes: 16 additions & 16 deletions docs/data-sources/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ Datasource for Astra database.

### Required

- **database_id** (String) The ID of the Astra database.
- **database_id** (String) Astra Database ID (system generated)

### Optional

- **id** (String) The ID of this resource.

### 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)


2 changes: 1 addition & 1 deletion examples/resources/existing_databases/resource.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data "astra_databases" "databaselist" {
status = "ACTIVE"
status = "ACTIVE"
}

output "existing_dbs" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
data "astra_databases" "databaselist" {
status = "ACTIVE"
status = "ACTIVE"
}

locals {
dbs = [for db in data.astra_databases.databaselist.results : db.id]
}

data "astra_secure_connect_bundle_url" "dev" {
for_each = toset(local.dbs)
for_each = toset(local.dbs)
database_id = each.value
}
7 changes: 3 additions & 4 deletions internal/provider/data_source_available_regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
12 changes: 6 additions & 6 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 8055b7f

Please sign in to comment.