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: adding in tag support #713

Merged
merged 25 commits into from
Oct 21, 2021
Merged

Conversation

tampajohn
Copy link
Contributor

@tampajohn tampajohn commented Oct 8, 2021

This PR is the beginning of adding in support for object_tags (https://docs.snowflake.com/en/user-guide/object-tagging.html).

It introduces the snowflake_tag resource which is used to define tags that can then be assigned to other objects within snowflake.

An example of declaring 2 tags, and assigning values for those tags on a table is:

resource "snowflake_tag" "department" {
  name     = "DEPARTMENT"
  schema   = "SOME_SCHEMA"
  database = "SOME_DB"
}

resource "snowflake_tag" "classification" {
  name     = "CLASSIFICATION"
  schema   = "SOME_SCHEMA"
  database = "SOME_DB"
}

resource "snowflake_table" "test_table" {
  schema   = "SOME_SCHEMA"
  database = "SOME_DB"
  name     = "EXAMPLE_TABLE"

  column {
    ...
  }

  tag {
    name     = snowflake_tag.classification.name
    database = snowflake_tag.classification.database
    schema   = snowflake_tag.classification.schema
    value    = "sensitive"
  }

  tag {
    name     = snowflake_tag.department.name
    database = snowflake_tag.department.database
    schema   = snowflake_tag.department.schema
    value    = "marketing"
  }
}

Test Plan

So far tests have been added to both the tag logic in snowflake and resources.

  • acceptance tests
  • unit tests

References

Addresses issue #702

@tampajohn tampajohn changed the title adding in tag support feat: adding in tag support Oct 8, 2021
@tampajohn
Copy link
Contributor Author

@alldoami As this is my first contribution, I wanted to open this draft up a little early to make sure I'm not going down the wrong path.

I'm going to continue on with adding tag support for various other object types, and possibly in a more generic way (at least for update / drop). My plan is to support tagging on the account, database, and schema level objects, with column support to likely follow in a separate PR.

@tampajohn tampajohn marked this pull request as ready for review October 20, 2021 20:46
@tampajohn tampajohn requested a review from alldoami October 20, 2021 20:46
@alldoami
Copy link
Contributor

make sure to run make docs :D

@tampajohn
Copy link
Contributor Author

Running make docs now lol... also I think I added support for tags on all objects supporting them just gotta double check the docs...

@alldoami
Copy link
Contributor

/ok-to-test sha=7a09873

@alldoami
Copy link
Contributor

Thanks for being so thorough with testing! 🥳

@tampajohn
Copy link
Contributor Author

Theres room for more testing on some of the resources... but I know this is a hot issue with some folks...

@github-actions
Copy link

Integration tests failure for 7a09873

@alldoami
Copy link
Contributor

/ok-to-test sha=4a8dc58

@github-actions
Copy link

Integration tests failure for 4a8dc58

@tampajohn
Copy link
Contributor Author

tampajohn commented Oct 20, 2021 via email

@alldoami
Copy link
Contributor

Just request my review again once you've committed these changes 😄

@alldoami
Copy link
Contributor

/ok-to-test sha=41ee8bc

@Snowflake-Labs Snowflake-Labs deleted a comment from github-actions bot Oct 21, 2021
@github-actions
Copy link

Integration tests success for 41ee8bc

@tampajohn
Copy link
Contributor Author

Thank you @alldoami !

@alldoami alldoami merged commit f75cd6e into Snowflake-Labs:main Oct 21, 2021
@tampajohn tampajohn deleted the object_tagging branch October 21, 2021 21:16
@tampajohn tampajohn mentioned this pull request Oct 27, 2021
daniepett pushed a commit to daniepett/terraform-provider-snowflake that referenced this pull request Feb 9, 2022
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.

2 participants