Skip to content
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

(possibly) unneeded/unused resource null_resource.module_depends_on created #1194

Open
swapzero opened this issue Apr 1, 2022 · 1 comment
Labels
bug Something isn't working P4 low priority issues triaged Scoped and ready for work

Comments

@swapzero
Copy link

swapzero commented Apr 1, 2022

TL;DR

A possibly unneeded/unused resource is created when calling the module and it's the only one created as part of that module call (enabled = false because defaults are used for parameters that affect enabled value)

Resource:

$ terraform state show ...

resource "null_resource" "module_depends_on" {
    id       = "4730592283587992509"
    triggers = {
        "value" = "2"
    }
}

The code that creates the resource is here and it gets called when module gcloud_delete_default_kube_dns_configmap is called.

Apparently, it is the only resource that doesn't use enabled module option, therefore it gets created even if enabled is false and occasionally shows changes when the nodepools are added/removed.

Expected behavior

The resource should also use enabled flag to avoid creation (module options that affect enabled are on defaults so in my case enabled = false)

 resource "null_resource" "module_depends_on" {
-  count = length(var.module_depends_on) > 0 ? 1 : 0
+  count = (length(var.module_depends_on) > 0 && var.enabled) ? 1 : 0
   triggers = {
     value = length(var.module_depends_on)
  }
}

Observed behavior

The only resource that is created as part of the submodule call and it has no effect alone.

Terraform Configuration

module "gke" {
  source  = "terraform-google-modules/kubernetes-engine/google//modules/beta-private-cluster-update-variant"
  version = "20.0.0"
...
}

Terraform Version

0.15.5

Additional information

No response

@swapzero swapzero added the bug Something isn't working label Apr 1, 2022
@morgante
Copy link
Contributor

morgante commented Apr 1, 2022

Since the resource has no impact, I don't think this is a major issue either way. You're welcome to file a PR on the gcloud repo.

@morgante morgante added triaged Scoped and ready for work P4 low priority issues labels Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P4 low priority issues triaged Scoped and ready for work
Projects
None yet
Development

No branches or pull requests

2 participants