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

Feature Request: local_exec parallelism controls #34931

Closed
zpbonjour opened this issue Apr 2, 2024 · 2 comments
Closed

Feature Request: local_exec parallelism controls #34931

zpbonjour opened this issue Apr 2, 2024 · 2 comments
Labels
duplicate issue closed because another issue already tracks this problem enhancement

Comments

@zpbonjour
Copy link

zpbonjour commented Apr 2, 2024

Terraform Version

1.7.4

Use Cases

I need to execute a CLI command several times per apply run based on some files in a local directory. I do not want to create a local_exec null resource for each of these files and create a mess of "depends_on" logic when a for_each loop could work so much better. The problem is that the CLI being executed by local_exec cannot be run more than one at a time as it locks the remote resource. This causes all other parallel executions to fail.

Attempted Solutions

Setting the global flag "-parallelism=1" solves my issue, but it slows down my entire apply run when I only need one specific resource block to not be executed in parallel.

Proposal

locals {
  my_files = fileset(path.module, "*.json")
}

resource "null_resource" "example" {
  for_each = local.my_files
  provisioner "local-exec" {
    command =  "mycommand -file $MY_FILE"
    parallelism = False  # NEW Option
    environment = {
      MY_FILE = each.value
    }
  }
}

Or as part of the APPLY parameters

terraform apply -var-file=vars.tfvars -no-parallelism=null_resource.example

References

No response

@zpbonjour zpbonjour added enhancement new new issue not yet triaged labels Apr 2, 2024
@jbardin
Copy link
Member

jbardin commented Apr 3, 2024

Duplicate of #14258

@jbardin jbardin marked this as a duplicate of #14258 Apr 3, 2024
@jbardin jbardin closed this as completed Apr 3, 2024
@crw crw added duplicate issue closed because another issue already tracks this problem and removed new new issue not yet triaged labels Apr 4, 2024
Copy link
Contributor

github-actions bot commented May 5, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate issue closed because another issue already tracks this problem enhancement
Projects
None yet
Development

No branches or pull requests

3 participants