-
Notifications
You must be signed in to change notification settings - Fork 428
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
Allow configuring storage_aws_external_id
for snowflake_storage_integration
#2624
Comments
Hey @AleksaC. Thanks for reaching out to us. We are currently working on redesigning existing resources as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#supporting-all-snowflake-ga-features. We will consider it when we will be going over |
Thanks for the response @sfc-gh-jcieslak. Do you have any ETA? Would you accept a PR to expedite this, since the change seems relatively straightforward to implement and shouldn't impact the redesign? |
I think it would be better If you could provide a PR for it, because I'm not sure when we would take care of the |
I should be able to pick it up in the next couple of days. I'll link the PR to this issue once I make progress on the stuff you mentioned. |
I'm also seeing this issue (a cyclic dependency between the AWS IAM role, and the Snowflake storage integration) - However I believe the fix is a bit more involved than just allowing the user to set AWS IAM roles require a valid assume role policy to be defined when the role is created. And AWS doesn't allow for external policies to grant assume_role access to additional principals/users outside of that inline policy document. So there is no way to perform these steps in this order:
While its in technically possible to convince AWS to relax that constraint - I'd anticipate that we won't make much headway there, and we'd have a better outcome refactoring the Snowflake provider to be compatible with AWS. I think the ideal pattern would be to split the snowflake_storage_integration into two resources: one resource that creates the IAM user that the integration will use (and makes it's ARN available as a resource attribute) - and another resource that creates (or finishes creating) the storage integration itself. This way you get a clean, linear resolution order of: |
@parsoj What you describe is not possible to achieve at the provider level because Snowflake API doesn't support creation of storage integration users. Currently a single user is used for all storage integrations:
I'm not sure how big of a change it would be to allow for creation of users for storage integrations, but even with the current situation it's easy to work around the issue by simply grabbing the user from a previous storage integration and passing it as a variable. Since the user is the same for all storage integrations it would be nice if it was possible to obtain its ARN independently of any storage integration. In this case it would be possible to introduce a data source that could get it, solving the problem completely. |
@AleksaC If there is only one IAM user for a Snowflake account, and it's static, that sounds really promising. I'm hoping that the IAM user for an account will always exist as long as the account does (and we don't have to create a storage integration to ensure the IAM user gets created)? If so - a data source sounds like just the ticket! @sfc-gh-jcieslak Also - from the docs for creating storage integrations, it looks like |
I saw that Snowflake is looking to do some broader re-design on it's Terraform provider. I think that's a great idea! Any API or SQL-based workflow that you currently have in the docs that requires an You may actually find it necessary to re-work some of your API workflows to support "immutability" in order to really get full Terraform support across the finish line. Everything has to be achievable with CREATE and read/SELECT statements only - otherwise there may always be some half-manual/half-terraform workflow that your TF provider requires. Thanks for listening 🙏 |
Hi all, I too had this issue! I resolved it by removing the dependency from the IAM role ARN to the storage integration. I managed this by computing the IAM role ARN from the AWS account ID and role name instead of reading it from the IAM role's outputs. This is a bit of a hack, I know, but it works in the meantime! The role name -> ARN function is at least simple enough that you can hopefully adapt my basic version to your environment.
|
Terraform CLI and Provider Versions
Terraform v1.7.5
on darwin_arm64
Use Cases or Problem Statement
There is a cycle between the storage integration and role used for the storage integration since the role needs Snowflake AWS user arn as well as external id in its trust policy. Since user is the same for all storage integrations in the same Snowflake account it can be provided as a variable, but that still leaves external id.
Fortunately Snowflake allows setting external id when creating the storage integration so I could just generate the storage integration and pass it to both the role as well as the storage integration removing the cycle.
Proposal
Make the
storage_aws_external_id
fieldOptional
instead ofComputed
since it's supported in the underlying API.How much impact is this issue causing?
Medium
Additional Information
No response
The text was updated successfully, but these errors were encountered: