-
Notifications
You must be signed in to change notification settings - Fork 430
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
[Feature]: Display OAuth expiration for security integration #3373
Comments
Hey @joscha 👋 |
I tried: resource "snowflake_execute" "integrations" {
execute = "SHOW INTEGRATIONS"
revert = ""
} but whilst that executes, it doesn't seem to yield anything. I also tried: resource "snowflake_execute" "integrations" {
execute = "SHOW INTEGRATIONS"
revert = "SHOW INTEGRATIONS"
query = "SHOW INTEGRATIONS"
} and a few combinations with
in those cases. Do I misunderstand? |
Nvm, this would probably end up in the same place. Snowflake allows you to adjust the timestamp output. Check parameters page and search for |
Thank you! Just so I understand this right: I would use the In that case I might actually just implement a custom Terraform function to parse the odd date format string, that sounds possibly less fragile. |
You should be able to use the original approach, this one: output "oauth_secret_expiration" {
value = timeadd(snowflake_oauth_integration_for_custom_clients.airtable_data.show_output[0].created_on, "${snowflake_oauth_integration_for_custom_clients.airtable_data.oauth_refresh_token_validity}s")
} When you change the parameter output format of create_on should be usable in timeadd (you have to adjust the format of it): show databases like 'test_database'; -- created_on = 2025-02-14 03:06:04.556 -0800
alter session set timestamp_ltz_output_format = 'YYYY-MM-DD';
show databases like 'test_database'; -- created_on = 2025-02-14 Note, that may affect how other resources are behaving as some of them potentially leverage timestamp fields. I believe that even a better solution would be to use the resource "snowflake_execute" "time" {
execute = "select 1"
revert = "select 1"
query = "SELECT TO_TIMESTAMP('2019-02-28T23:59:59', 'YYYY-MM-DD\"T\"HH24:MI:SS') AS TIME"
}
output "time_output" {
value = snowflake_execute.time.query_results.0["TIME"]
} But you have to replace the arguments in This could be a good use case for custom Terraform functions. cc: @sfc-gh-jmichalak @sfc-gh-asawicki |
Company Name
Planet A GmbH
Use Cases or Problem Statement
Airtable support synchronizing data from Snowflake: https://support.airtable.com/docs/airtable-sync-integration-snowflake
This uses an external OAuth token to do so. This token is not refreshed by Airtable, the onus is on the person setting up the integration.
We would love to display when the token expires. The data is available in Snowflake and also in terraform, but it's not entirely usable right now.
Given an integration like this:
I was hoping to be able to just read the
created_on
output and add theoauth_refresh_token_validity
to it, i.e.:however,
created_on
is some mixture of ISO 8601 with a timezone abbreviation or so (YYYY-MM-DD HH24:MI:SS.FF3 TZH TZM
)? Thus this fails with:It would be great if:
expires_on
SHOW INTEGRATIONS
(wherecreated_on
is an actual terraform timestamp, Snowflake itself returns some ISO 8601 but with a TZ identifier and it can't be queried viaSELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));
so usingTO_TIMESTAMP_TZ
is out of the question, too.)Category
category:resource
Object type(s)
resource:oauth_integration
Proposal
In order of preference:
expires_on
is exposedintegrations
data source that has atimestamp
for thecreated_on
column.How much impact is this issue causing?
Low
Additional Information
No response
Would you like to implement a fix?
The text was updated successfully, but these errors were encountered: