Skip to content

Commit

Permalink
fix: run check docs (#1306)
Browse files Browse the repository at this point in the history
* fix: run check docs

* fix int error

* fix int error

* fix int error

* fix int error

* fix int error

* fix int error

* fix int error
  • Loading branch information
sfc-gh-swinkler authored Oct 28, 2022
1 parent c1e763c commit 53698c9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
5 changes: 1 addition & 4 deletions docs/resources/masking_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ resource "snowflake_masking_policy" "example_masking_policy" {
### Read-Only

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

### Read-Only

- **qualified_name** (String) Specifies the qualified identifier for the masking policy.
- `qualified_name` (String) Specifies the qualified identifier for the masking policy.

## Import

Expand Down
14 changes: 14 additions & 0 deletions docs/resources/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ resource snowflake_task serverless_task {
when = "foo AND bar"
enabled = true
}
resource snowflake_task test_task {
comment = "task with allow_overlapping_execution"
database = "db"
schema = "schema"
name = "test_task"
sql_statement = "select 1 as c;"
allow_overlapping_execution = true
enabled = true
}
```

<!-- schema generated by tfplugindocs -->
Expand All @@ -69,6 +82,7 @@ resource snowflake_task serverless_task {
### Optional

- `after` (String) Specifies the predecessor task in the same database and schema of the current task. When a run of the predecessor task finishes successfully, it triggers this task (after a brief lag). (Conflict with schedule)
- `allow_overlapping_execution` (Boolean) By default, Snowflake ensures that only one instance of a particular DAG is allowed to run at a time, setting the parameter value to TRUE permits DAG runs to overlap.
- `comment` (String) Specifies a comment for the task.
- `enabled` (Boolean) Specifies if the task should be started (enabled) after creation or should remain suspended (default).
- `error_integration` (String) Specifies the name of the notification integration used for error notifications.
Expand Down
18 changes: 17 additions & 1 deletion pkg/resources/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,27 @@ func ReadTask(d *schema.ResourceData, meta interface{}) error {
return err
}

err = d.Set(AllowOverlappingExecution, t.AllowOverlappingExecution)
allowOverlappingExecutionValue, err := t.AllowOverlappingExecution.Value()
if err != nil {
return err
}

if allowOverlappingExecutionValue != nil && allowOverlappingExecutionValue.(string) != "null" {
allowOverlappingExecution, err := strconv.ParseBool(allowOverlappingExecutionValue.(string))
if err != nil {
return err
}
err = d.Set("allow_overlapping_execution", allowOverlappingExecution)
if err != nil {
return err
}
} else {
err = d.Set("allow_overlapping_execution", false)
if err != nil {
return err
}
}

// The "DESCRIBE TASK ..." command returns the string "null" for error_integration
if t.ErrorIntegration.String == "null" {
t.ErrorIntegration.Valid = false
Expand Down
2 changes: 1 addition & 1 deletion pkg/snowflake/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ type task struct {
Definition string `db:"definition"`
Condition *string `db:"condition"`
ErrorIntegration sql.NullString `db:"error_integration"`
AllowOverlappingExecution *bool `db:"allow_overlapping_execution"`
AllowOverlappingExecution sql.NullString `db:"allow_overlapping_execution"`
}

func (t *task) IsEnabled() bool {
Expand Down

0 comments on commit 53698c9

Please sign in to comment.