Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed Nov 21, 2024
1 parent c35bf68 commit 2e60e0b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/resources/storage_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resource "snowflake_storage_integration" "integration" {

- `name` (String)
- `storage_allowed_locations` (List of String) Explicitly limits external stages that use the integration to reference one or more storage locations.
- `storage_provider` (String)
- `storage_provider` (String) Specifies the storage provider for the integration. Valid options are: `S3` | `S3GOV` | `S3CHINA` | `GCS` | `AZURE`

### Optional

Expand Down
3 changes: 2 additions & 1 deletion pkg/resources/storage_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ var storageIntegrationSchema = map[string]*schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateDiagFunc: StringInSlice(append(sdk.AsStringList(sdk.AllS3Protocols), "GCS", "AZURE"), true),
ValidateDiagFunc: StringInSlice(sdk.AllStorageProviders, true),
Description: fmt.Sprintf("Specifies the storage provider for the integration. Valid options are: %s", possibleValuesListed(sdk.AllStorageProviders)),
},
"storage_aws_external_id": {
Type: schema.TypeString,
Expand Down
9 changes: 6 additions & 3 deletions pkg/sdk/storage_integration_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package sdk

import (
"fmt"
g "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/poc/generator"
"strings"

g "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/poc/generator"
)

//go:generate go run ./poc/main.go
Expand All @@ -16,7 +17,10 @@ const (
ChinaS3Protocol S3Protocol = "S3CHINA"
)

var AllS3Protocols = []S3Protocol{RegularS3Protocol, GovS3Protocol, ChinaS3Protocol}
var (
AllS3Protocols = []S3Protocol{RegularS3Protocol, GovS3Protocol, ChinaS3Protocol}
AllStorageProviders = append(AsStringList(AllS3Protocols), "GCS", "AZURE")
)

func ToS3Protocol(s string) (S3Protocol, error) {
switch protocol := S3Protocol(strings.ToUpper(s)); protocol {
Expand Down Expand Up @@ -47,7 +51,6 @@ var StorageIntegrationDef = g.NewInterface(
"S3StorageProviderParams",
g.NewQueryStruct("S3StorageParams").
PredefinedQueryStructField("Protocol", g.KindOfT[S3Protocol](), g.ParameterOptions().SQL("STORAGE_PROVIDER").SingleQuotes().Required()).
//PredefinedQueryStructField("storageProvider", "string", g.StaticOptions().SQL("STORAGE_PROVIDER = 'S3'")).
TextAssignment("STORAGE_AWS_ROLE_ARN", g.ParameterOptions().SingleQuotes().Required()).
OptionalTextAssignment("STORAGE_AWS_OBJECT_ACL", g.ParameterOptions().SingleQuotes()),
g.KeywordOptions(),
Expand Down
3 changes: 2 additions & 1 deletion pkg/sdk/storage_integration_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package sdk

import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestStorageIntegrations_Create(t *testing.T) {
Expand Down

0 comments on commit 2e60e0b

Please sign in to comment.