terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
Database from share using organization.account as a provider
Is your feature request related to a problem? Please describe.
Following new snowflake release, when creating a database from share instead of account locator you can specify source as ORGANIZATION.ACCOUNT.SHARE
. This is not supported by current (0.37.1) version of the provider. Adding ORGANIZATION.ACCOUNT
in the provider
field results in error, because of the quoting here.
Describe the solution you'd like
The clearest for me would be to add fields organization
, account
and account_locator
, that would replace provider
in snowflake_database
resource. Where user has to provide either organization
and account
or account_locator
.
Describe alternatives you've considered
Could also live with provider
properly handling ORGANIZATION.ACCOUNT
format.
Additional context
This is an issue for my use case as well. It looks like #1090 also addressed this as well, but was closed as using a fully-qualified name seemed to the be the preference over . I'd love to help here if I can.
@sfc-gh-swinkler @marcin-vt @gouline Is anyone actively working on this or should I throw my own PR into the mix?
It is supported, you have to use escaped middle quotes as discussed in #1090 and illustrated in the from_replica
example in snowflake_database.
resource "snowflake_database" "database" {
name = "DATABASE_NAME"
from_share = {
provider = "ORGANIZATION\".\"ACCOUNT"
share = "SHARE"
}
}
Thanks for the answer @gouline. It does work - just look a bit awkward... Also as a side remark when creating database from share, comment is ignored. It is applied when running for the second time.
btw. @gouline are you working on moving from from_share
to fully qualified names? If so I guess I can close the PR #1114 .
It does work - just look a bit awkward...
I agree, but it's consistent with from_replica
and that's the preference of the maintainers.
Also as a side remark when creating database from share, comment is ignored. It is applied when running for the second time.
Good point, the create statement just runs create database from share
and nothing else. You're welcome to contribute a fix, just need to build that create statement iteratively (like in most other resources).
are you working on moving from
from_share
to fully qualified names? If so I guess I can close the PR #1114 .
Provider is already a fully-qualified name (i.e. ORGANIZATION\".\"ACCOUNT
). The only change would be to abolish the map in favour of a full string, like from_replica
, but that's a breaking change for little benefit, so I'm not working on it.
@gouline makes a good point. We need to update the documentation to make this more clear, however.
Agreed on documentation, I had to look at the code to figure it out. @marcin-vt also raised a bug here that comment isn't getting included in the create statement (only update).
Happy to raise a PR with those 2 fixes, unless somebody else wants to.