Skip to content
This repository was archived by the owner on Aug 14, 2021. It is now read-only.
This repository was archived by the owner on Aug 14, 2021. It is now read-only.

Parse terraform variables #10

@spuder

Description

@spuder

rhcl can't parse variables like var.foobar

Example

data "external" "foobar" {
  program = ["ruby", "${var.puppet_repo}/bin/terraform/read-hiera.rb"]
  query = {
    "puppet_repo"           = var.puppet_repo
    "hiera_file"            = "${var.puppet_repo}/hiera/env/${var.environment}/foobar.yaml"
  }
 }

irb

require 'rhcl'
require 'json'
file=/tmp/foo.tf
Rhcl.parse(file)
Racc::ParseError (parse error on value: =)
  2: data "external" "foobar" {
  3:   program = ["ruby", "${var.puppet_repo}/bin/terraform/read-hiera.rb"]
  4:   query = {
*  5:     "puppet_repo"            __=__  var.puppet_repo
  6:     "hiera_file"            = "${var.puppet_repo}/hiera/env/${var.environment}/foobar.yaml"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions