Skip to content

Commit

Permalink
Add remaining integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Jul 9, 2024
1 parent e25635b commit c76b42e
Show file tree
Hide file tree
Showing 25 changed files with 734 additions and 105 deletions.
9 changes: 9 additions & 0 deletions pkg/acceptance/check_destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ var showByIdFunctions = map[resources.Resource]showByIdFunc{
resources.Alert: func(ctx context.Context, client *sdk.Client, id sdk.ObjectIdentifier) error {
return runShowById(ctx, id, client.Alerts.ShowByID)
},
resources.ApiAuthenticationIntegrationWithAuthorizationCodeGrant: func(ctx context.Context, client *sdk.Client, id sdk.ObjectIdentifier) error {
return runShowById(ctx, id, client.SecurityIntegrations.ShowByID)
},
resources.ApiAuthenticationIntegrationWithClientCredentials: func(ctx context.Context, client *sdk.Client, id sdk.ObjectIdentifier) error {
return runShowById(ctx, id, client.SecurityIntegrations.ShowByID)
},
resources.ApiAuthenticationIntegrationWithJwtBearer: func(ctx context.Context, client *sdk.Client, id sdk.ObjectIdentifier) error {
return runShowById(ctx, id, client.SecurityIntegrations.ShowByID)
},
resources.ApiIntegration: func(ctx context.Context, client *sdk.Client, id sdk.ObjectIdentifier) error {
return runShowById(ctx, id, client.ApiIntegrations.ShowByID)
},
Expand Down
252 changes: 252 additions & 0 deletions pkg/datasources/security_integrations_acceptance_test.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "snowflake_api_authentication_integration_with_authorization_code_grant" "test" {
comment = var.comment
enabled = var.enabled
name = var.name
oauth_access_token_validity = var.oauth_access_token_validity
oauth_authorization_endpoint = var.oauth_authorization_endpoint
oauth_client_auth_method = var.oauth_client_auth_method
oauth_client_id = var.oauth_client_id
oauth_client_secret = var.oauth_client_secret
oauth_refresh_token_validity = var.oauth_refresh_token_validity
oauth_token_endpoint = var.oauth_token_endpoint
oauth_allowed_scopes = var.oauth_allowed_scopes
}

data "snowflake_security_integrations" "test" {
depends_on = [snowflake_api_authentication_integration_with_authorization_code_grant.test]

like = var.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
variable "comment" {
type = string
}
variable "enabled" {
type = bool
}
variable "name" {
type = string
}
variable "oauth_access_token_validity" {
type = number
}
variable "oauth_authorization_endpoint" {
type = string
}
variable "oauth_client_auth_method" {
type = string
}
variable "oauth_client_id" {
type = string
}
variable "oauth_client_secret" {
type = string
}
variable "oauth_refresh_token_validity" {
type = number
}
variable "oauth_token_endpoint" {
type = string
}
variable "oauth_allowed_scopes" {
type = set(string)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "snowflake_api_authentication_integration_with_authorization_code_grant" "test" {
comment = var.comment
enabled = var.enabled
name = var.name
oauth_access_token_validity = var.oauth_access_token_validity
oauth_authorization_endpoint = var.oauth_authorization_endpoint
oauth_client_auth_method = var.oauth_client_auth_method
oauth_client_id = var.oauth_client_id
oauth_client_secret = var.oauth_client_secret
oauth_refresh_token_validity = var.oauth_refresh_token_validity
oauth_token_endpoint = var.oauth_token_endpoint
oauth_allowed_scopes = var.oauth_allowed_scopes
}

data "snowflake_security_integrations" "test" {
depends_on = [snowflake_api_authentication_integration_with_authorization_code_grant.test]

with_describe = false
like = var.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
variable "comment" {
type = string
}
variable "enabled" {
type = bool
}
variable "name" {
type = string
}
variable "oauth_access_token_validity" {
type = number
}
variable "oauth_authorization_endpoint" {
type = string
}
variable "oauth_client_auth_method" {
type = string
}
variable "oauth_client_id" {
type = string
}
variable "oauth_client_secret" {
type = string
}
variable "oauth_refresh_token_validity" {
type = number
}
variable "oauth_token_endpoint" {
type = string
}
variable "oauth_allowed_scopes" {
type = set(string)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
resource "snowflake_oauth_integration_for_custom_clients" "test" {
blocked_roles_list = var.blocked_roles_list
comment = var.comment
enabled = var.enabled
name = var.name
network_policy = var.network_policy
oauth_allow_non_tls_redirect_uri = var.oauth_allow_non_tls_redirect_uri
oauth_client_rsa_public_key = var.oauth_client_rsa_public_key
oauth_client_rsa_public_key_2 = var.oauth_client_rsa_public_key_2
oauth_client_type = var.oauth_client_type
oauth_enforce_pkce = var.oauth_enforce_pkce
oauth_issue_refresh_tokens = var.oauth_issue_refresh_tokens
oauth_redirect_uri = var.oauth_redirect_uri
oauth_refresh_token_validity = var.oauth_refresh_token_validity
oauth_use_secondary_roles = var.oauth_use_secondary_roles
pre_authorized_roles_list = var.pre_authorized_roles_list
}


data "snowflake_security_integrations" "test" {
depends_on = [snowflake_oauth_integration_for_custom_clients.test]

like = var.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

variable "blocked_roles_list" {
type = set(string)
}
variable "comment" {
type = string
}
variable "enabled" {
type = bool
}
variable "name" {
type = string
}
variable "network_policy" {
type = string
}
variable "oauth_allow_non_tls_redirect_uri" {
type = bool
}
variable "oauth_client_rsa_public_key" {
type = string
}
variable "oauth_client_rsa_public_key_2" {
type = string
}
variable "oauth_client_type" {
type = string
}
variable "oauth_enforce_pkce" {
type = bool
}
variable "oauth_issue_refresh_tokens" {
type = bool
}
variable "oauth_redirect_uri" {
type = string
}
variable "oauth_refresh_token_validity" {
type = number
}
variable "oauth_use_secondary_roles" {
type = string
}
variable "pre_authorized_roles_list" {
type = set(string)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
resource "snowflake_oauth_integration_for_custom_clients" "test" {
blocked_roles_list = var.blocked_roles_list
comment = var.comment
enabled = var.enabled
name = var.name
network_policy = var.network_policy
oauth_allow_non_tls_redirect_uri = var.oauth_allow_non_tls_redirect_uri
oauth_client_rsa_public_key = var.oauth_client_rsa_public_key
oauth_client_rsa_public_key_2 = var.oauth_client_rsa_public_key_2
oauth_client_type = var.oauth_client_type
oauth_enforce_pkce = var.oauth_enforce_pkce
oauth_issue_refresh_tokens = var.oauth_issue_refresh_tokens
oauth_redirect_uri = var.oauth_redirect_uri
oauth_refresh_token_validity = var.oauth_refresh_token_validity
oauth_use_secondary_roles = var.oauth_use_secondary_roles
pre_authorized_roles_list = var.pre_authorized_roles_list
}


data "snowflake_security_integrations" "test" {
depends_on = [snowflake_oauth_integration_for_custom_clients.test]

with_describe = false
like = var.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

variable "blocked_roles_list" {
type = set(string)
}
variable "comment" {
type = string
}
variable "enabled" {
type = bool
}
variable "name" {
type = string
}
variable "network_policy" {
type = string
}
variable "oauth_allow_non_tls_redirect_uri" {
type = bool
}
variable "oauth_client_rsa_public_key" {
type = string
}
variable "oauth_client_rsa_public_key_2" {
type = string
}
variable "oauth_client_type" {
type = string
}
variable "oauth_enforce_pkce" {
type = bool
}
variable "oauth_issue_refresh_tokens" {
type = bool
}
variable "oauth_redirect_uri" {
type = string
}
variable "oauth_refresh_token_validity" {
type = number
}
variable "oauth_use_secondary_roles" {
type = string
}
variable "pre_authorized_roles_list" {
type = set(string)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "snowflake_oauth_integration_for_partner_applications" "test" {
name = var.name
oauth_client = var.oauth_client
blocked_roles_list = var.blocked_roles_list
enabled = var.enabled
oauth_issue_refresh_tokens = var.oauth_issue_refresh_tokens
oauth_refresh_token_validity = var.oauth_refresh_token_validity
oauth_use_secondary_roles = var.oauth_use_secondary_roles
comment = var.comment
}

data "snowflake_security_integrations" "test" {
depends_on = [snowflake_oauth_integration_for_partner_applications.test]

like = var.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variable "name" {
type = string
}
variable "oauth_client" {
type = string
}
variable "blocked_roles_list" {
type = set(string)
}
variable "enabled" {
type = string
}
variable "oauth_issue_refresh_tokens" {
type = string
}
variable "oauth_refresh_token_validity" {
type = string
}
variable "oauth_use_secondary_roles" {
type = string
}
variable "comment" {
type = string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "snowflake_oauth_integration_for_partner_applications" "test" {
name = var.name
oauth_client = var.oauth_client
blocked_roles_list = var.blocked_roles_list
enabled = var.enabled
oauth_issue_refresh_tokens = var.oauth_issue_refresh_tokens
oauth_refresh_token_validity = var.oauth_refresh_token_validity
oauth_use_secondary_roles = var.oauth_use_secondary_roles
comment = var.comment
}

data "snowflake_security_integrations" "test" {
depends_on = [snowflake_oauth_integration_for_partner_applications.test]

with_describe = false
like = var.name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variable "name" {
type = string
}
variable "oauth_client" {
type = string
}
variable "blocked_roles_list" {
type = set(string)
}
variable "enabled" {
type = string
}
variable "oauth_issue_refresh_tokens" {
type = string
}
variable "oauth_refresh_token_validity" {
type = string
}
variable "oauth_use_secondary_roles" {
type = string
}
variable "comment" {
type = string
}
9 changes: 9 additions & 0 deletions pkg/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,12 @@ func MergeMaps[M ~map[K]V, K comparable, V any](src ...M) M {
}
return merged
}

// TODO: use slices.Concat in Go 1.22
func ConcatSlices[T any](slices ...[]T) []T {
var tmp []T
for _, s := range slices {
tmp = append(tmp, s...)
}
return tmp
}
Loading

0 comments on commit c76b42e

Please sign in to comment.