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

Add data source snowflake_current_account #567

Merged
merged 2 commits into from
Jun 11, 2021

Conversation

robbruce
Copy link
Contributor

Creates a new data source snowflake_current_account which allows the account information to be read and then passed into other systems as part of a terraform deployment.

This avoids having to pass in the same information as variables to terraform and can use the information supplied by the provider.

Test Plan

  • acceptance tests
  • unit tests
$ go test -v ./... -run TestCurrentAccount
?   	github.com/chanzuckerberg/terraform-provider-snowflake	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/datasources	1.027s [no tests to run]
?   	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/db	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/provider	1.515s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/resources	1.333s [no tests to run]
=== RUN   TestCurrentAccountSelect
--- PASS: TestCurrentAccountSelect (0.00s)
=== RUN   TestCurrentAccountRead
=== RUN   TestCurrentAccountRead/aws_oregon
2021/06/10 13:45:00 [DEBUG] query stmt SELECT CURRENT_ACCOUNT() AS "account", CURRENT_REGION() AS "region";
=== RUN   TestCurrentAccountRead/aws_n_virginia
2021/06/10 13:45:00 [DEBUG] query stmt SELECT CURRENT_ACCOUNT() AS "account", CURRENT_REGION() AS "region";
=== RUN   TestCurrentAccountRead/aws_canada_central
2021/06/10 13:45:00 [DEBUG] query stmt SELECT CURRENT_ACCOUNT() AS "account", CURRENT_REGION() AS "region";
=== RUN   TestCurrentAccountRead/gcp_canada_central
2021/06/10 13:45:00 [DEBUG] query stmt SELECT CURRENT_ACCOUNT() AS "account", CURRENT_REGION() AS "region";
=== RUN   TestCurrentAccountRead/azure_washington
2021/06/10 13:45:00 [DEBUG] query stmt SELECT CURRENT_ACCOUNT() AS "account", CURRENT_REGION() AS "region";
--- PASS: TestCurrentAccountRead (0.00s)
    --- PASS: TestCurrentAccountRead/aws_oregon (0.00s)
    --- PASS: TestCurrentAccountRead/aws_n_virginia (0.00s)
    --- PASS: TestCurrentAccountRead/aws_canada_central (0.00s)
    --- PASS: TestCurrentAccountRead/gcp_canada_central (0.00s)
    --- PASS: TestCurrentAccountRead/azure_washington (0.00s)
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/snowflake	1.327s
?   	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/testhelpers	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/validation	1.117s [no tests to run]
?   	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/version	[no test files]
$ TF_ACC=1 go test -v ./... -run TestAccCurrentAccount
?   	github.com/chanzuckerberg/terraform-provider-snowflake	[no test files]
=== RUN   TestAccCurrentAccount
=== PAUSE TestAccCurrentAccount
=== CONT  TestAccCurrentAccount
--- PASS: TestAccCurrentAccount (6.11s)
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/datasources	7.036s
?   	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/db	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/provider	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/resources	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/snowflake	(cached) [no tests to run]
?   	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/testhelpers	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/validation	(cached) [no tests to run]
?   	github.com/chanzuckerberg/terraform-provider-snowflake/pkg/version	[no test files]

References

N/A

@robbruce robbruce requested a review from a team as a code owner June 10, 2021 12:47
@robbruce robbruce requested a review from alldoami June 10, 2021 12:47
@alldoami
Copy link
Contributor

Wanted to add some reference links: https://docs.snowflake.com/en/sql-reference/functions/current_account.html
I didn't know this function existed 😅

@alldoami
Copy link
Contributor

/ok-to-test sha=a097dc4

@github-actions
Copy link

Integration tests success for a097dc4

@alldoami alldoami merged commit 7be1fc9 into Snowflake-Labs:main Jun 11, 2021
jtzero pushed a commit to rxrevu/terraform-provider-snowflake that referenced this pull request Aug 19, 2021
anton-chekanov pushed a commit to anton-chekanov/terraform-provider-snowflake that referenced this pull request Jan 25, 2022
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