amazon-web-servicesdeploymentterraformterraform-provider-awsaws-step-functions

Step function not deployable through terraform


I am trying to deploy AWS Step Function using Terraform but the deployment is failing with the below error

Failed to execute "terraform init"
fork/exec /usr/local/bin/terraform: argument list too long

Terragrunt code I'm executing

terragrunt init --terragrunt-non-interactive -terragrunt-log-level error
terragrunt plan --terragrunt-non-interactive -terragrunt-log-level error

The problem is I have a step function which is of 10900 lines

Please provide me some help. Am I right in identifying the problem? or is there any other issue?


Solution

  • I had the same issue as that of https://github.com/gruntwork-io/terragrunt/issues/2132

    The problem was the step function's definition was getting as an command line argument which hit the kernel's limit of 128KB (ref)

    Tweaked the solution posted in https://github.com/gruntwork-io/terragrunt/issues/2132#issuecomment-1188287900

    Created a *.tfvars.json file instead of *.tfvars file using the generate function and the definition variable gets created on the fly and this definition is used by the parent terraform module.(ref)

    generate "vars_input" {
      path              = "variables.auto.tfvars.json"
      if_exists         = "overwrite"
      disable_signature = true
      contents          = <<EOF
    {
      "definition": ${file("${get_path_to_repo_root()}/step_function_file.json")}
    }
    EOF
    }