Skip to content

Terraform apply does not report error if snippet VCL is invalid #737

@jimr6007

Description

@jimr6007

Terraform Version

Terraform v1.3.9
on linux_amd64
+ provider registry.terraform.io/fastly/fastly v5.3.1
+ provider registry.terraform.io/hashicorp/aws v4.46.0

Your version of Terraform is out of date! The latest version
is 1.5.5. You can update by downloading from https://www.terraform.io/downloads.html

Affected Fastly Terraform Resource(s)

Please list the affected resources, for example:

  • fastly_service_vcl

Terraform Configuration Files

vcl {
    name    = "main"
    content = "${file("${path.module}/main.vcl")}"
    main    = true
  }

compared to 

snippet {
    name    = "log4j-detect"
    content = "${file("${path.module}/snippet-log4j-detect.vcl")}"
    type    = "recv"
  }

Expected Behavior

When I "terraform apply" with activate=false I'm expecting to see errors from the Fastly API if my VCL has errors.
This is exactly what happens when I include the "vcl" parameter with "content"

however, with a "snippet" if the there is invalid VCL, the terraform apply reports "success"
even though in the Fastly webui console we see that for the Service in question we now have a new draft that is reporting invalid VCL

What should have happened?

a "snippet" with invalid VCL should result in a "terraform apply"with "activate=false being a failure, non-zero return status

Actual Behavior

a "snippet" with invalid VCL and "terraform apply"with "activate=false returns 0, terraform apply "okay"
but the webui console does show a new draft, with VCL errors

Debug Output (optional)

Please provide a link to a GitHub Gist containing the complete debug output (see Terraform docs). Ensure any sensitive data is <REDACTED>.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids (optional)

Is there anything atypical about your account or set up that we should know?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions