-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Dependant kms module resource is being created when create_kms_key is set to false. Breaks in air-gapped environment. #2803
Comments
unfortunately this is Terraform's behavior - any source definitions will be pulled whether they are used or not. that goes for providers and modules This means your options are:
|
So we attempted to add a count param to the module and although it does stop the data lookup resources. it does look like it is downloading the module source still :( we'll have to see how our env is getting modules to see if option #2 is viable or not. Even though it will still download the module source, would it be acceptable to have the change to do the count change so the unused data resources are not utilized? |
Which data sources? |
I think these are the two: https://github.com/terraform-aws-modules/terraform-aws-kms/blob/master/main.tf#L1-L2 not huge overhead, but the making the module.kms optional from a terraform sense and not instantiating it if we won't be using it seems to make sense. |
Here is our current draft of a diff that we are testing with (I think some of the var.create_key_kms may need to get changed to the local.create_kms, but this is the current rev):
|
I've updated those here terraform-aws-modules/terraform-aws-kms#25 - we should be able bump the module version used once thats released |
ah, that works too. :) Appreciate the quick response! Hey, on this line in the eks module: (and I haven't dug deep to see if this boolean condition could even be valid) |
If encryption is not enabled, then the KMS module does not create a key Line 127 in e4c5098
create_kms_key = true
and we don't enter the loop that assigns the key (either created or provided) to be used Line 63 in e4c5098
This line Line 67 in e4c5098
Does that help clarify? |
it does. thank you. yeah, I hadn't dove into the boolean conditions fully, the conditional caught my eye when I was seeing what ref'd module.kms. so I was thinking you really couldn't get into that condition, appreciate you clarifying the why that is the case :) |
It can be a fickle beast to navigate 😅 |
Thanks for the improvements made here. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
This is happening in the latest version (v19.18.0) of this TF module.
I'm working in an air-gapped environment with no internet access. The environment where TF is being ran has all required providers present and this module mirrored, so there is no need to fetch them from the internet. We have an internal TF module which fully manages KMS keys already. So when calling this module we set "create_kms_key" to false and then pass our own KMS arn under "cluster_encryption_config" to the module for use by the cluster's resources.
Code snippet
and the resulting error:
I would expect that when setting "create_kms_key = false" TF would not attempt to call that module at all.
Possibly adding a "count" argument to the KMS module call would resolve this? Or is there some other solution here I've overlooked?
The text was updated successfully, but these errors were encountered: