Skip to content

Commit b5bb9ff

Browse files
authored
Add oneof validation to cluster options type (#35)
1 parent fe87c9a commit b5bb9ff

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.github/workflows/release.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ jobs:
3434
- name: Run GoReleaser
3535
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
3636
with:
37-
args: release --clean
37+
args: release --clean ${{ env.SIGNING_DISABLED == 'true' && '--skip sign' }}
3838
env:
3939
# GitHub sets the GITHUB_TOKEN secret automatically.
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
# GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
41+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
42+
SIGNING_DISABLED: 'true'

internal/provider/datasources/data_source_cluster_options_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package datasources_test
22

33
import (
44
"fmt"
5+
"regexp"
56
"testing"
67

78
"github.com/astronomer/astronomer-terraform-provider/internal/utils"
@@ -18,6 +19,10 @@ func TestAcc_DataSourceClusterOptions(t *testing.T) {
1819
},
1920
ProtoV6ProviderFactories: astronomerprovider.TestAccProtoV6ProviderFactories,
2021
Steps: []resource.TestStep{
22+
{
23+
Config: astronomerprovider.ProviderConfig(t, true) + clusterOptions("invalid", "AWS"),
24+
ExpectError: regexp.MustCompile(`type value must be one of`),
25+
},
2126
{
2227
Config: astronomerprovider.ProviderConfig(t, true) + clusterOptions("HYBRID", "AWS"),
2328
Check: resource.ComposeTestCheckFunc(

internal/provider/schemas/cluster_options.go

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ func ClusterOptionsDataSourceSchemaAttributes() map[string]schema.Attribute {
8282
},
8383
"type": schema.StringAttribute{
8484
Required: true,
85+
Validators: []validator.String{
86+
stringvalidator.OneOf(
87+
string(platform.ClusterTypeDEDICATED),
88+
string(platform.ClusterTypeHYBRID),
89+
),
90+
},
8591
},
8692
"cloud_provider": schema.StringAttribute{
8793
Optional: true,

0 commit comments

Comments
 (0)