-
Notifications
You must be signed in to change notification settings - Fork 429
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
Single item in set #211
Comments
@jmak123 I think this is a general terraform question. The terraform configuration language, HCL allows trailing commas at the end of lists. The comma you see in the "compiled state to be applied" is a result of terraform rendering the plan in a form that looks like HCL configuration. It seems that what is happening here is that the |
@ryanking After I applied the changes above, I reran
Terraform keeps asking to apply this change no matter how many times I have applied this. My suspicion is that there is a trailing comma here but not when it gets written into state file, hence there's always a difference between the I wonder if anyone else has experienced this? If it's an HCL issue then I should have found more of these issues in forums. |
I have the same issue! This is only a problem on warehouses that have different kind of grants on them though.
I have applied the plan successfully but the next time I run terraform plan the change still shows up, |
I'm experiencing the same problem with Terraform 0.13.0, Snowflake provider 0.13.2. For the sake of clarity, I used the $ tf plan -target='module.warehouse_bi.snowflake_warehouse_grant.warehouse_grant_monitor[0]' -out=tfplan
$ tf apply -target='module.warehouse_bi.snowflake_warehouse_grant.warehouse_grant_monitor[0]' tfplan
$ tf plan -target='module.warehouse_bi.snowflake_warehouse_grant.warehouse_grant_monitor[0]' -out=tfplan
|
Found the problem. If a role is given all the privileges for a given resource(except For example, for a warehouse, if a role has all the grants available for a warehouse, At least that is the problem for my case. The easiest way to reproduce this problem might be for warehouse_grants, as per the OP's example. Give a role "usage, operate, monitor, modify" grants to a warehouse. Then apply the changes, and run |
Any movement on this? We are having substantial problems with this |
We face a side issue in the way that the grant resources have been setup, in that you cannot declare the same privilege on the same resource in 2 different locations. This most common use-case is the use of Initial creation is just fine, as it just adds the role, but re-apply removes the other role. For example
resource "snowflake_role" "this" {
name = "BASE_ROLE"
}
resource "snowflake_role" "this" {
name = "SUB_ROLE_1"
}
resource "snowflake_role_grants" "this" {
# or some other means of reading base
role_name = data.terraform_remote_state.base.outputs.snowflake_role_name
roles = toset([snowflake_role.this.name])
}
resource "snowflake_role" "this" {
name = "SUB_ROLE_2"
}
resource "snowflake_role_grants" "this" {
# or some other means of reading base
role_name = data.terraform_remote_state.base.outputs.snowflake_role_name
roles = toset([snowflake_role.this.name])
} Calling @ryanking - any objections if we were to issue a pull request that accepts a single role (or user for a |
Any thoughts on this @robbruce? I for one would really like the interface to behave the way you are describing here! |
I'm more of a fan of the idea of new resources that specifically take a single role etc. The idea of changing behaviour based on whether the input variable is a string vs. a list seems like it would be quite prone to accidents. Having singular-named resources that accept a string seems a bit clearer, so you would have both: I also like the way the AWS provider handles this kind of relationship, like in the above mentioned For the roles case, this would look like:
Or you have individually defined grant resources, one for each user and role being granted. I think the AWS-style approach is most in-line with what I've seen in other TF providers, but it's obviously much more backwards-incompatible than just creating a new set of singular resources. |
is there a workaround for this issue? |
Struggling with the same issue on our side. I believe this inbounded issue is the same problem as well. As other users mentioned, it appears there is a trailing comma generated during the plan, but not existing in the state file. So terraform keeps asking keeps asking to apply the same change even though it has already been applied. Curious if there is any work around. |
Having the same issue. Any updates on this? |
We are closing this issue as part of a cleanup described in announcement. If you believe that the issue is still valid in v0.89.0, please open a new ticket. |
Not sure if this is more a general terraform question or specific to this provider because of its implementation.
When a set has only one value and it uses interpolation, the compiled state (to be applied) has a list with trailing comma after each value in the set. When deployed though, the state file records a list without any trailing comma for the last value. Thus, even with no change in config, rerunning
apply
will comes with warning of forced replacement of the list because the compiled version always has trailing comma, but the remote state doesn't.config:
compiled state to be applied:
but the remote state always stays
Is it a bug and is there a way to force terraform to use either with or without trailing comma in the last set value across local and remote states?
The text was updated successfully, but these errors were encountered: