Skip to content

Commit

Permalink
feat: Add allowed values (#1028)
Browse files Browse the repository at this point in the history
* Add allowed_values field to the snowflake_tag resource

* Add allowed_values field to the snowflake_tag resource

* Fixing doc and adding example for snowflake_tag resource

* Fixing doc and adding example for snowflake_tag resource

* testing allowed_values

* testing allowed_values

* testing allowed_values

* testing allowed_values

* testing allowed_values

* testing allowed_values

* adding example usage for snowflake_tag resource

* minor fixes

* Moving ListToSnowflakeString functions to helpers directory

* Moving ListToSnowflakeString functions to helpers directory

* pull changes from snowflakelabs/terraform-provider-snowflake

* Updating import

* Updating import for tag

* Updating import

* Updating acceptance tests of table annd tag for allowed_values

* Replaced GetChange() method with Get()

* fixing conflict

Co-authored-by: Scott Winkler <scott.winkler@snowflake.com>
Co-authored-by: Allison Doami <adoami@chanzuckerberg.com>
  • Loading branch information
3 people authored May 31, 2022
1 parent d066d0b commit e756867
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pkg/helpers/list_to_string_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ func ListToSnowflakeString(list []string) string {
list[index] = fmt.Sprintf(`'%v'`, strings.ReplaceAll(element, "'", "\\'"))
}

str := fmt.Sprintf(strings.Join(list, ", "))
return str
return fmt.Sprintf("%v", strings.Join(list, ", "))
}

// IpListToString formats a list of IPs into a Snowflake-DDL friendly string, e.g. ('192.168.1.0', '192.168.1.100')
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func UpdateTag(d *schema.ResourceData, meta interface{}) error {
// If there is change in allowed_values field
if d.HasChange("allowed_values") {
if _, ok := d.GetOk("allowed_values"); ok {
_, v := d.GetChange("allowed_values")
v := d.Get("allowed_values")

ns := expandAllowedValues(v)

Expand Down

0 comments on commit e756867

Please sign in to comment.