generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add region type filtering for regions (#391)
- Loading branch information
1 parent
f4853d5
commit 6af6ee3
Showing
7 changed files
with
177 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 34 additions & 1 deletion
35
examples/data-sources/astra_available_regions/data-source.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
data "astra_available_regions" "regions" { | ||
# Get all available "serverless" regions. With no filtering only "serverless" regions are returned. | ||
data "astra_available_regions" "serverless_regions" { | ||
} | ||
|
||
# Get all available "serverless" regions, with explicit filtering for "serverless" | ||
data "astra_available_regions" "serverless_regions" { | ||
region_type = "serverless" | ||
} | ||
|
||
# Get all available "vector" regions | ||
data "astra_available_regions" "vector_regions" { | ||
region_type = "vector" | ||
} | ||
|
||
# Get all available regions, regardless of type | ||
data "astra_available_regions" "all_regions" { | ||
region_type = "all" | ||
} | ||
|
||
# Filter regions by cloud provider (one of "aws", "azure", "gcp") | ||
data "astra_available_regions" "aws_serverless_regions" { | ||
cloud_provider = "aws" | ||
} | ||
|
||
# Filter regions by enabled status | ||
data "astra_available_regions" "enabled_regions" { | ||
only_enabled = true | ||
} | ||
|
||
# Filter only enabled regions in GCP for vector | ||
data "astra_available_regions" "gcp_vector_regions" { | ||
region_type = "vector" | ||
cloud_provider = "gcp" | ||
only_enabled = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package provider | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAvailableRegionsDataSource(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAvailableRegionsDataSource(), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
// https://www.terraform.io/docs/extend/testing/acceptance-tests/index.html | ||
func testAccAvailableRegionsDataSource() string { | ||
return fmt.Sprintf(` | ||
data "astra_available_regions" "dev" { | ||
} | ||
`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters