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 allowed values #1006

Merged
merged 23 commits into from
May 26, 2022
Merged

feat: add allowed values #1006

merged 23 commits into from
May 26, 2022

Conversation

sfc-gh-kumaurya
Copy link
Contributor

Added allowed_values attribute to snowflake_tag resource

Test Plan

  • These changes has been tested for unit, internal and acceptance tests.

References

issue link: #815

@@ -256,6 +273,16 @@ func ReadTag(d *schema.ResourceData, meta interface{}) error {
return err
}

av := strings.ReplaceAll(t.AllowedValues.String, "\"", "")
Copy link

@sfc-gh-afedorov sfc-gh-afedorov May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this still work if someone wants a tag value like foo[bar]? instead of re-writing a partial parser, can we re-use an existing helper function?

}
d := schema.TestResourceDataRaw(t, resources.Tag().Schema, in)
r.NotNil(d)

WithMockDb(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
mock.ExpectExec(
`^CREATE TAG "test_db"."test_schema"."good_name" COMMENT = 'great comment'$`,
`^CREATE TAG "test_db"."test_schema"."good_name" ALLOWED_VALUES 'marketing', 'finance' COMMENT = 'great comment'$`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test case like CREATE OR REPLACE TAG test."foo[bar]" ALLOWED_VALUES '1', '2["3"]';

@sfc-gh-kumaurya sfc-gh-kumaurya changed the title Add allowed values feat: add allowed values May 17, 2022
pkg/resources/tag.go Outdated Show resolved Hide resolved
pkg/resources/tag.go Outdated Show resolved Hide resolved
pkg/resources/tag.go Outdated Show resolved Hide resolved
pkg/resources/tag.go Outdated Show resolved Hide resolved
pkg/resources/tag.go Show resolved Hide resolved
pkg/snowflake/tag.go Outdated Show resolved Hide resolved
@sfc-gh-swinkler
Copy link
Collaborator

sfc-gh-swinkler commented May 25, 2022

/ok-to-test sha=92c16cc

@Snowflake-Labs Snowflake-Labs deleted a comment from github-actions bot May 25, 2022
@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=92c16cc

@github-actions
Copy link

Integration tests failure for 92c16cc

@sfc-gh-swinkler
Copy link
Collaborator

{XDTRAZHROA XDTRAZHROA XDTRAZHROA XDTRAZHROA}
    tag_acceptance_test.go:15: Step 1/1 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # snowflake_tag.test will be updated in-place
          ~ resource "snowflake_tag" "test" {
              ~ allowed_values = [
                  - "",
                ]
                comment        = "Terraform acceptance test"
                database       = "XDTRAZHROA"
                id             = "XDTRAZHROA|XDTRAZHROA|XDTRAZHROA"
                name           = "XDTRAZHROA"
                schema         = "XDTRAZHROA"
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAcc_Tag (4.35s)

error during integration test. can you please verify this test case passes and then push a commit to fix?

@sfc-gh-swinkler sfc-gh-swinkler self-requested a review May 25, 2022 19:12
@sfc-gh-swinkler
Copy link
Collaborator

/ok-to-test sha=1ffdd57

@github-actions
Copy link

Integration tests success for 1ffdd57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants