Skip to content

Commit

Permalink
Merge pull request #1 from chanzuckerberg/main
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
funes79 authored Apr 30, 2021
2 parents 3f9f58b + bbe0577 commit 766e671
Show file tree
Hide file tree
Showing 39 changed files with 2,356 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ifndef KEYBASE_KEY_ID
endif
.PHONY: check-release-prereqs

release: check-release-prereqs ## run a release
release: setup check-release-prereqs ## run a release
./bin/bff bump
git push
goreleaser release --debug --rm-dist
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.23.2
0.25.0
57 changes: 57 additions & 0 deletions docs/resources/api_integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "snowflake_api_integration Resource - terraform-provider-snowflake"
subcategory: ""
description: |-
---

# snowflake_api_integration (Resource)



## Example Usage

```terraform
resource "snowflake_api_integration" "api_integration" {
name = "aws_integration"
api_provider = "aws_api_gateway"
api_aws_role_arn = "arn:aws:iam::000000000001:/role/test"
api_allowed_prefixes = ["https://123456.execute-api.us-west-2.amazonaws.com/prod/"]
enabled = true
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **api_allowed_prefixes** (List of String) Explicitly limits external functions that use the integration to reference one or more HTTPS proxy service endpoints and resources within those proxies.
- **api_provider** (String) Specifies the HTTPS proxy service type.
- **name** (String) Specifies the name of the API integration. This name follows the rules for Object Identifiers. The name should be unique among api integrations in your account.

### Optional

- **api_aws_role_arn** (String) ARN of a cloud platform role.
- **api_blocked_prefixes** (List of String) Lists the endpoints and resources in the HTTPS proxy service that are not allowed to be called from Snowflake.
- **azure_ad_application_id** (String) The 'Application (client) id' of the Azure AD app for your remote service.
- **azure_tenant_id** (String) Specifies the ID for your Office 365 tenant that all Azure API Management instances belong to.
- **enabled** (Boolean) Specifies whether this API integration is enabled or disabled. If the API integration is disabled, any external function that relies on it will not work.
- **id** (String) The ID of this resource.

### Read-Only

- **api_aws_external_id** (String) The external ID that Snowflake will use when assuming the AWS role.
- **api_aws_iam_user_arn** (String) The Snowflake user that will attempt to assume the AWS role.
- **azure_consent_url** (String)
- **azure_multi_tenant_app_name** (String)
- **created_on** (String) Date and time when the API integration was created.

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_api_integration.example name
```
88 changes: 88 additions & 0 deletions docs/resources/external_function.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "snowflake_external_function Resource - terraform-provider-snowflake"
subcategory: ""
description: |-
---

# snowflake_external_function (Resource)



## Example Usage

```terraform
resource "snowflake_external_function" "test_ext_func" {
name = "my_function"
database = "my_test_db"
schema = "my_test_schema"
arg {
name = "arg1"
type = "varchar"
}
arg {
name = "arg2"
type = "varchar"
}
return_type = "varchar"
return_behavior = "IMMUTABLE"
api_integration = "api_integration_name"
url_of_proxy_and_resource = "https://123456.execute-api.us-west-2.amazonaws.com/prod/test_func"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **api_integration** (String) The name of the API integration object that should be used to authenticate the call to the proxy service.
- **database** (String) The database in which to create the external function.
- **name** (String) Specifies the identifier for the external function. The identifier can contain the schema name and database name, as well as the function name. The function's signature (name and argument data types) must be unique within the schema.
- **return_behavior** (String) Specifies the behavior of the function when returning results
- **return_type** (String) Specifies the data type returned by the external function.
- **schema** (String) The schema in which to create the external function.
- **url_of_proxy_and_resource** (String) This is the invocation URL of the proxy service and resource through which Snowflake calls the remote service.

### Optional

- **arg** (Block List) Specifies the arguments/inputs for the external function. These should correspond to the arguments that the remote service expects. (see [below for nested schema](#nestedblock--arg))
- **comment** (String) A description of the external function.
- **compression** (String) If specified, the JSON payload is compressed when sent from Snowflake to the proxy service, and when sent back from the proxy service to Snowflake.
- **context_headers** (List of String) Binds Snowflake context function results to HTTP headers.
- **header** (Block List) Allows users to specify key-value metadata that is sent with every request as HTTP headers. (see [below for nested schema](#nestedblock--header))
- **id** (String) The ID of this resource.
- **max_batch_rows** (Number) This specifies the maximum number of rows in each batch sent to the proxy service.
- **null_input_behavior** (String) Specifies the behavior of the external function when called with null inputs.
- **return_null_allowed** (Boolean) Indicates whether the function can return NULL values or must return only NON-NULL values.

### Read-Only

- **created_on** (String) Date and time when the external function was created.

<a id="nestedblock--arg"></a>
### Nested Schema for `arg`

Required:

- **name** (String) Argument name
- **type** (String) Argument type, e.g. VARCHAR


<a id="nestedblock--header"></a>
### Nested Schema for `header`

Required:

- **name** (String) Header name
- **value** (String) Header value

## Import

Import is supported using the following syntax:

```shell
# format is database name | schema name | external function name | <list of function arg types, separated with '-'>
terraform import snowflake_external_function.example 'dbName|schemaName|externalFunctionName|varchar-varchar-varchar'
```
31 changes: 31 additions & 0 deletions docs/resources/masking_policy_grant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "snowflake_masking_policy_grant Resource - terraform-provider-snowflake"
subcategory: ""
description: |-
---

# snowflake_masking_policy_grant (Resource)





<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **database_name** (String) The name of the database containing the masking policy on which to grant privileges.
- **masking_policy_name** (String) The name of the masking policy on which to grant privileges immediately.
- **schema_name** (String) The name of the schema containing the masking policy on which to grant privileges.

### Optional

- **id** (String) The ID of this resource.
- **privilege** (String) The privilege to grant on the masking policy.
- **roles** (Set of String) Grants privilege to these roles.
- **with_grant_option** (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.


8 changes: 4 additions & 4 deletions docs/resources/materialized_view_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ description: |-
## Example Usage

```terraform
resource snowflake_view_grant grant {
database_name = "db"
schema_name = "schema"
materialized_view_name = "materialized_view"
resource "snowflake_materialized_view_grant" "grant" {
database_name = "db"
schema_name = "schema"
materialized_view_name = "materialized_view"
privilege = "select"
roles = [
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ Import is supported using the following syntax:

```shell
# format is database name | schema name | table name
terraform import snowflake_table.example
terraform import snowflake_table.example 'databaseName|schemaName|tableName'
```
1 change: 1 addition & 0 deletions examples/resources/snowflake_api_integration/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import snowflake_api_integration.example name
7 changes: 7 additions & 0 deletions examples/resources/snowflake_api_integration/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "snowflake_api_integration" "api_integration" {
name = "aws_integration"
api_provider = "aws_api_gateway"
api_aws_role_arn = "arn:aws:iam::000000000001:/role/test"
api_allowed_prefixes = ["https://123456.execute-api.us-west-2.amazonaws.com/prod/"]
enabled = true
}
2 changes: 2 additions & 0 deletions examples/resources/snowflake_external_function/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# format is database name | schema name | external function name | <list of function arg types, separated with '-'>
terraform import snowflake_external_function.example 'dbName|schemaName|externalFunctionName|varchar-varchar-varchar'
17 changes: 17 additions & 0 deletions examples/resources/snowflake_external_function/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "snowflake_external_function" "test_ext_func" {
name = "my_function"
database = "my_test_db"
schema = "my_test_schema"
arg {
name = "arg1"
type = "varchar"
}
arg {
name = "arg2"
type = "varchar"
}
return_type = "varchar"
return_behavior = "IMMUTABLE"
api_integration = "api_integration_name"
url_of_proxy_and_resource = "https://123456.execute-api.us-west-2.amazonaws.com/prod/test_func"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource snowflake_view_grant grant {
database_name = "db"
schema_name = "schema"
materialized_view_name = "materialized_view"
resource "snowflake_materialized_view_grant" "grant" {
database_name = "db"
schema_name = "schema"
materialized_view_name = "materialized_view"

privilege = "select"
roles = [
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/snowflake_table/import.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# format is database name | schema name | table name
terraform import snowflake_table.example
terraform import snowflake_table.example 'databaseName|schemaName|tableName'
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,6 @@ github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/snowflakedb/gosnowflake v1.4.0 h1:tt3nMrv+qQ4DZtTjasornB6nD8siIU5VpTI+qEyK4sc=
github.com/snowflakedb/gosnowflake v1.4.0/go.mod h1:6nfka9aTXkUNha1p1cjeeyjDvcyh7jfjp0l8kGpDBok=
github.com/snowflakedb/gosnowflake v1.4.1 h1:5Yu1Pi0wh6gyebzxtwmngd63VtUIps1HvrmLwxtpAEI=
github.com/snowflakedb/gosnowflake v1.4.1/go.mod h1:6nfka9aTXkUNha1p1cjeeyjDvcyh7jfjp0l8kGpDBok=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
Expand All @@ -671,6 +669,7 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
Expand Down
3 changes: 3 additions & 0 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func GetGrantResources() resources.TerraformGrantResources {
"snowflake_file_format_grant": resources.FileFormatGrant(),
"snowflake_function_grant": resources.FunctionGrant(),
"snowflake_integration_grant": resources.IntegrationGrant(),
"snowflake_masking_policy_grant": resources.MaskingPolicyGrant(),
"snowflake_materialized_view_grant": resources.MaterializedViewGrant(),
"snowflake_procedure_grant": resources.ProcedureGrant(),
"snowflake_resource_monitor_grant": resources.ResourceMonitorGrant(),
Expand All @@ -106,7 +107,9 @@ func GetGrantResources() resources.TerraformGrantResources {

func getResources() map[string]*schema.Resource {
others := map[string]*schema.Resource{
"snowflake_api_integration": resources.APIIntegration(),
"snowflake_database": resources.Database(),
"snowflake_external_function": resources.ExternalFunction(),
"snowflake_managed_account": resources.ManagedAccount(),
"snowflake_masking_policy": resources.MaskingPolicy(),
"snowflake_materialized_view": resources.MaterializedView(),
Expand Down
Loading

0 comments on commit 766e671

Please sign in to comment.