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 failover groups to sdk v2, and add data source for failover groups #1825

Merged
merged 13 commits into from
May 30, 2023

Conversation

sfc-gh-swinkler
Copy link
Collaborator

  • add failover groups resource to v2 sdk
  • add a new data source for failover groups
  • add sweepers for cleanup purpose

@github-actions
Copy link

Integration tests failure for 2ff6905b90338d6297281346d7b0c336d8a4eaa4

@github-actions
Copy link

Integration tests failure for d521726dff4525eb7d47ddc4a28ef85edf015d75

pkg/sdk/validations.go Fixed Show fixed Hide fixed
pkg/sdk/validations.go Outdated Show resolved Hide resolved
@github-actions
Copy link

Integration tests failure for ed41d5733ed7810c9ba94835bc27077c73b13d6e

@github-actions
Copy link

Integration tests failure for 5f885321fe3e63f40e2f52a40c271cc1c68dab04

@github-actions
Copy link

Integration tests failure for f3f66b6e9dce698dd15401ac6871c75a2dbeb8e8

@danu165
Copy link

danu165 commented May 23, 2023

Looking forward to using failover groups in terraform! Would you mind adding failover group grants as well? That would help enable managing failover groups completely in terraform.

@sfc-gh-swinkler
Copy link
Collaborator Author

sfc-gh-swinkler commented May 23, 2023

Looking forward to using failover groups in terraform! Would you mind adding failover group grants as well? That would help enable managing failover groups completely in terraform.

Thats a good idea, i can do that.

@sfc-gh-swinkler
Copy link
Collaborator Author

@danu165 So i am looking at which grant resources would need to be added and I am not sure which grant you are referring to. From https://docs.snowflake.com/en/user-guide/account-replication-config#step-3-create-a-role-with-the-create-failover-group-privilege-in-the-target-account-optional we already have an account_grant resource that can grant "CREATE FAILOVER GROUP" to a role.

resource "snowflake_role" "test" {
  name = "myrole1"
}

resource "snowflake_account_grant" "test" {
  roles     = [snowflake_role.test.name]
  privilege = "CREATE FAILOVER GROUP"
}

However this is too much permissions if only using the data source. Which would require any of:

FAILOVER

MONITOR

OWNERSHIP

REPLICATE

https://docs.snowflake.com/en/sql-reference/sql/show-failover-groups#usage-notes.

Is this what you mean?

@danu165
Copy link

danu165 commented May 23, 2023

Yes, I am referring to possibly creating a new resource named “snowflake_failover_group_grant” that could grant those 4 privileges that you mentioned.

pkg/sdk/client.go Outdated Show resolved Hide resolved
@github-actions
Copy link

Integration tests failure for f3f66b6e9dce698dd15401ac6871c75a2dbeb8e8

@github-actions
Copy link

Integration tests failure for ad04d7966cc78f32846d0ae0f9ead07a062eb572

pkg/sdk/shares_integration_test.go Show resolved Hide resolved
pkg/sdk/shares_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/object_types.go Outdated Show resolved Hide resolved
pkg/sdk/sweepers.go Outdated Show resolved Hide resolved
}

t.Run("all sweepers in secondary account", func(t *testing.T) {
client := testSecondaryClient(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe create a few resources and check they're gone after?

pkg/sdk/failover_groups.go Outdated Show resolved Hide resolved
@github-actions
Copy link

Integration tests failure for 5cc52ffe47b2c1ab6904cc31e4175678a0a263d1

@github-actions
Copy link

Integration tests failure for a7f4a0af48aca4fbea2f5bbae53612bcf5ff8815

@github-actions
Copy link

Integration tests failure for 471901d83c02a397d3650e8d944de33bf89486e4

@github-actions
Copy link

Integration tests failure for d8437998b142af80c1b4cd7fc04f5c2f9dcbc074

@github-actions
Copy link

Integration tests success for 05f00407a8c548a19dbb8ec4f8c481baaec35ae0

@github-actions
Copy link

Integration tests failure for 21402d617a6acb7949c75012c2280ac4ce089496

@github-actions
Copy link

Integration tests success for ad7bffdd864219f54101111aa0acd22f84e8ab2c

@sfc-gh-swinkler sfc-gh-swinkler merged commit 44e8c06 into main May 30, 2023
@sfc-gh-swinkler sfc-gh-swinkler deleted the failover-group-sdk branch May 30, 2023 05:35
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