Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add parameters resources + ds #1429

Merged
merged 7 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions docs/data-sources/parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "snowflake_parameters Data Source - terraform-provider-snowflake"
subcategory: ""
description: |-

---

# snowflake_parameters (Data Source)



## Example Usage

```terraform
resource "snowflake_database" "d" {
name = "TEST_DB"
}

// read all object parameters in database TEST_DB
data "snowflake_parameters" "p" {
parameter_type = "OBJECT"
object_type = "DATABASE"
object_name = snowflake_database.d.name
}

// read all account parameters with the pattern '%TIMESTAMP%'
data "snowflake_parameters" "p2" {
parameter_type = "ACCOUNT"
pattern = "%TIMESTAMP%"
}

// read the exact session parameter ROWS_PER_RESULTSET
data "snowflake_parameters" "p3" {
parameter_type = "SESSION"
pattern = "ROWS_PER_RESULTSET"
}
```

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

### Optional

- `object_name` (String) If parameter_type is set to "OBJECT" then object_name is the name of the object to display object parameters for.
- `object_type` (String) If parameter_type is set to "OBJECT" then object_type is the type of object to display object parameters for. Valid values are any object supported by the IN clause of the [SHOW PARAMETERS](https://docs.snowflake.com/en/sql-reference/sql/show-parameters.html#parameters) statement, including: WAREHOUSE | DATABASE | SCHEMA | TASK | TABLE
- `parameter_type` (String) The type of parameter to filter by. Valid values are: "ACCOUNT", "SESSION", "OBJECT".
- `pattern` (String) Allows limiting the list of parameters by name using LIKE clause. Refer to [Limiting the List of Parameters by Name](https://docs.snowflake.com/en/sql-reference/parameters.html#limiting-the-list-of-parameters-by-name)

### Read-Only

- `id` (String) The ID of this resource.
- `parameters` (List of Object) The pipes in the schema (see [below for nested schema](#nestedatt--parameters))

<a id="nestedatt--parameters"></a>
### Nested Schema for `parameters`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `type` (String)
- `value` (String)


45 changes: 45 additions & 0 deletions docs/resources/account_parameter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "snowflake_account_parameter Resource - terraform-provider-snowflake"
subcategory: ""
description: |-

---

# snowflake_account_parameter (Resource)



## Example Usage

```terraform
resource "snowflake_account_parameter" "p" {
key = "ALLOW_ID_TOKEN"
value = "true"
}

resource "snowflake_account_parameter" "p2" {
key = "CLIENT_ENCRYPTION_KEY_SIZE"
value = "256"
}
```

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

### Required

- `key` (String) Name of account parameter. Valid values are those in [account parameters](https://docs.snowflake.com/en/sql-reference/parameters.html#account-parameters).
- `value` (String) Value of account parameter, as a string. Constraints are the same as those for the parameters in Snowflake documentation.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_account_parameter.p <parameter_name>
```
60 changes: 60 additions & 0 deletions docs/resources/object_parameter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "snowflake_object_parameter Resource - terraform-provider-snowflake"
subcategory: ""
description: |-

---

# snowflake_object_parameter (Resource)



## Example Usage

```terraform
resource "snowflake_database" "d" {
name = "TEST_DB"
}

resource "snowflake_schema" "s" {
name = "TEST_SCHEMA"
database = snowflake_database.d.name
}

resource "snowflake_object_parameter" "o" {
key = "ENABLE_STREAM_TASK_REPLICATION"
value = "true"
object_type = "DATABASE"
object_name = snowflake_database.d.name
}

resource "snowflake_object_parameter" "o2" {
key = "PIPE_EXECUTION_PAUSED"
value = "false"
object_type = "SCHEMA"
object_name = "${snowflake_database.d.name}.${snowflake_schema.s.name}"
}
```

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

### Required

- `key` (String) Name of object parameter. Valid values are those in [object parameters](https://docs.snowflake.com/en/sql-reference/parameters.html#object-parameters).
- `object_name` (String) Name of object to which the parameter applies.
- `object_type` (String) Type of object to which the parameter applies. Valid values are those in [object types](https://docs.snowflake.com/en/sql-reference/parameters.html#object-types).
- `value` (String) Value of object parameter, as a string. Constraints are the same as those for the parameters in Snowflake documentation.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_object_parameter.s <key>❄️<object_type>❄️<object_name>
```
40 changes: 40 additions & 0 deletions docs/resources/session_parameter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "snowflake_session_parameter Resource - terraform-provider-snowflake"
subcategory: ""
description: |-

---

# snowflake_session_parameter (Resource)



## Example Usage

```terraform
resource "snowflake_session_parameter" "s" {
key = "AUTOCOMMIT"
value = "false"
}
```

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

### Required

- `key` (String) Name of session parameter. Valid values are those in [session parameters](https://docs.snowflake.com/en/sql-reference/parameters.html#session-parameters).
- `value` (String) Value of session parameter, as a string. Constraints are the same as those for the parameters in Snowflake documentation.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_session_parameter.s <parameter_name>
```
22 changes: 22 additions & 0 deletions examples/data-sources/snowflake_parameters/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "snowflake_database" "d" {
name = "TEST_DB"
}

// read all object parameters in database TEST_DB
data "snowflake_parameters" "p" {
parameter_type = "OBJECT"
object_type = "DATABASE"
object_name = snowflake_database.d.name
}

// read all account parameters with the pattern '%TIMESTAMP%'
data "snowflake_parameters" "p2" {
parameter_type = "ACCOUNT"
pattern = "%TIMESTAMP%"
}

// read the exact session parameter ROWS_PER_RESULTSET
data "snowflake_parameters" "p3" {
parameter_type = "SESSION"
pattern = "ROWS_PER_RESULTSET"
}
1 change: 1 addition & 0 deletions examples/resources/snowflake_account_parameter/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import snowflake_account_parameter.p <parameter_name>
9 changes: 9 additions & 0 deletions examples/resources/snowflake_account_parameter/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "snowflake_account_parameter" "p" {
key = "ALLOW_ID_TOKEN"
value = "true"
}

resource "snowflake_account_parameter" "p2" {
key = "CLIENT_ENCRYPTION_KEY_SIZE"
value = "256"
}
1 change: 1 addition & 0 deletions examples/resources/snowflake_object_parameter/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import snowflake_object_parameter.s <key>❄️<object_type>❄️<object_name>
22 changes: 22 additions & 0 deletions examples/resources/snowflake_object_parameter/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "snowflake_database" "d" {
name = "TEST_DB"
}

resource "snowflake_schema" "s" {
name = "TEST_SCHEMA"
database = snowflake_database.d.name
}

resource "snowflake_object_parameter" "o" {
key = "ENABLE_STREAM_TASK_REPLICATION"
value = "true"
object_type = "DATABASE"
object_name = snowflake_database.d.name
}

resource "snowflake_object_parameter" "o2" {
key = "PIPE_EXECUTION_PAUSED"
value = "false"
object_type = "SCHEMA"
object_name = "${snowflake_database.d.name}.${snowflake_schema.s.name}"
}
1 change: 1 addition & 0 deletions examples/resources/snowflake_session_parameter/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import snowflake_session_parameter.s <parameter_name>
4 changes: 4 additions & 0 deletions examples/resources/snowflake_session_parameter/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "snowflake_session_parameter" "s" {
key = "AUTOCOMMIT"
value = "false"
}
Loading