Comments (2)
Hello @spanhotra !
While it is an interesting use case, there isn't much we can do about it, as this is the intended behavior of Terraform providers. Values for configuration arguments to providers must be known during the plan. In this example, the role would not be known until after the apply, so it is rightfully throwing an error about the role not existing. From the official documentation on provider configuration:
https://developer.hashicorp.com/terraform/language/providers/configuration#provider-configuration-1
You can use expressions in the values of these configuration arguments but can only reference values that are known before the configuration is applied. This means you can safely reference input variables but not attributes exported by resources (with an exception for resource arguments that are specified directly in the configuration).
What you could do instead is perform a two-step operation. First, apply without the module, only creating roles you need to use later. Then, you can safely add the module back and use the roles since they will have already been created. You can also use data sources instead of resources, as the values will be known during the plan. Also, you can split this into two workspaces, the first workspaces creating the roles and the second workspace using the roles. I know that none of these suggestions are as convenient as using a single Terraform workspace, but they would at least unblock you.
I could perhaps think of a convoluted way to get this to work, despite the limitations of Terraform, such as delaying the initialization of the client until it's absolutely needed, but it wouldn't work for situations where you already had existing resources or imported resources. I'm not sure we want to go down that path, though.
Hope this helps,
Scott
from terraform-provider-snowflake.
Thank you @sfc-gh-swinkler for your response.
I will go ahead with your suggestion and create 2 step process for this.
May be this could be a feature request, a similar tool called Pulumi does support Dynamic Providers.
from terraform-provider-snowflake.
Related Issues (20)
- snowflake warehouses break if not enterprise because of query_acceleration_max_scale_factor HOT 1
- snowflake_object_parameter resource import has missing fields HOT 1
- snowflake_schema crashing when importing HOT 2
- Event Table resource missing? HOT 2
- grant_privileges_to_role doesn't recognize changes to `with_grant_option` that were made outside of Terraform HOT 15
- snowflake roles appear as deleted after upgrading from provider 0.84.1 to 0.85.0 HOT 8
- Failed to instantiate provider "registry.terraform.io/snowflake-labs/snowflake" HOT 2
- Managed account broken after rename in 0.85 HOT 2
- snowflake_grant_privileges_to_role all_privileges=true not updating the DB state correctly HOT 1
- [Docs]: Resource migration guide should inform about new capabilities in terraform 1.7 HOT 1
- Test
- test2
- Possible wrong string escape method. HOT 1
- Deprecation error message after provider upgrade from 0.66.2 to 0.85.0 HOT 2
- Add support for compute pools, image repositories, and services HOT 4
- Warning: Show with OnAll option is skipped. HOT 1
- Why error handling in user.go was reverted (@sfc-gh-pbosak) HOT 1
- Add support for network rules HOT 6
- data_retention_time_in_days = 0 must be defined in snowflake_database from share HOT 3
- error on dynamic table refresh during HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-snowflake.