spacelift-io / terraform-provider-spacelift

Terraform provider to interact with Spacelift
MIT License
74 stars 28 forks source link

`spacelift_stack` resource does not support `terragrunt` block #464

Closed Cwagne17 closed 1 year ago

Cwagne17 commented 1 year ago

Bug Description

Terraform Version: 1.5.5 Spacelift Provider Version: 0.1.37

The terragrunt block in the spacelift_stack resource does not get parsed properly by the provider causing an error.

image

Steps to Reproduce

  1. Add a terragrunt block or use a dynamic terraform block for terragrunt
resource "spacelift_stack" "this" {
  # other configuration

  terragrunt {
      terraform_version      = var.terraform_version
      terragrunt_version     = var.terragrunt_version
      use_run_all            = var.terragrunt_use_run_all
      use_smart_sanitization = true
    }
}

or with dynamic configuration

resource "spacelift_stack" "this" {
  # other configuration

  dynamic "terragrunt" {
    for_each = var.terragrunt_version ? [1] : []

    content {
      terraform_version      = var.terraform_version
      terragrunt_version     = var.terragrunt_version
      use_run_all            = var.terragrunt_use_run_all
      use_smart_sanitization = true
    }
  }
}
  1. Run terraform init followed by terraform plan, the plan step should produce the error
image

Expected Behavior

Terragrunt block should not have result with an error. Also an example of using terragrunt should be added to the examples.