Coder Social home page Coder Social logo

Comments (2)

kvrhdn avatar kvrhdn commented on July 21, 2024

I'm not a huge fan of this kind of processing within the provider as it would not be transparent to user. So far we haven't had to modify user input to make it compliant to the API (as far as I can remember at least).
Additionally, if the Honeycomb API and UI start to support newlines (not unlikely imo) the behaviour from the provider would be annoying.

Does wrapping the string with trimspace work? This should remove all spaces and newlines.

My preferred solutions in order:

  • if this breaks the Honeycomb UI, the Honeycomb API should refuse this
  • we should document a workaround (e.g. if trimspace works)
  • maybe we can show a Terraform warning if we detect newlines in the expression field
  • we can add a validation rule to the expression field (but I'd like to avoid this as this will require a code change if the API changes)

from terraform-provider-honeycombio.

vlinevych avatar vlinevych commented on July 21, 2024

Thanks for your input.

  • Honeycomb team is notified and has filed a bug
  • trimspace does help
  • Documentation update: PR #83

An example of working terraform code:

resource "honeycombio_derived_column" "tmp_action" {
  alias       = "tmp_action"
  dataset     = var.dataset
  description = "SLI: successful action"
  expression  = trimspace(<<EOT
  IF(
    REG_MATCH($request, `PATCH https://www.whatever.[a-z]+:443/gw/api/subscriptions/[0-9]+/bar?`),
    AND(
      OR(
        STARTS_WITH($backend_status_code, "2"), 
        STARTS_WITH($backend_status_code, "3"), 
        STARTS_WITH($backend_status_code, "4")
      ),
      LTE($backend_processing_time, 2)
    )
  )
  EOT
  )
}

from terraform-provider-honeycombio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.