这是indexloc提供的服务,不要输入任何密码
Skip to content

Error: hcl Unmarshal failed: Missing newline after block definition #23

@efernandes-dev-ops

Description

@efernandes-dev-ops

Describe the bug
I get the following error when I try to run my clarity test.


  Scenario: we allow iam users access to view billing # account.feature:3
    Given HCL2 # account.feature:4
      Error: hcl Unmarshal failed: parse hcl2 config: 
 [:50,2-10: Missing newline after block definition; A block definition must end with a newline. 
]

The following below are the files I've got in my module:

variables.tf file

variable "name" {
  description = "Account name prefix"
  type            = string
}

variable "account" {
  description = "The account type being created (prod, nonprod, tools, sandbox)"
  type            = string
}

variable "parent" {
  description = "The ID of the parent - Root account or OU"
  type            = string
}

variable "ou" {
  description = "The name of the OU - used to create email address"
  type            = string
}

variable "email_prefix" {
  description = "Email to attach to this account"
  type            = string
}

variable "email_domain" {
  description = "Email domain"
  type            = string
}

variable "role_name" {
  description = "Name of the role that will be automatically trusted from the master account"
  type            = string
}

variable "tags" {
  default = []
}

variable "name" {
   description = "Name for account"
   type = string
}

variable "email {
   description = "Email for account"
   type = string
}

account.tf file

resource "aws_organizations_account" "ou_account" {
     name                       = var.name
     email                       = var.email
     parent_id                = var.parent
     iam_user_access_to_billing = "ALLOW"
     role_name              = var.role_name
     tags                        = var.tags
}

account.feature file

Feature: We should have an aws account and as such we should configure the account correctly

  Scenario: we allow iam users access to view billing
    Given HCL2
    And a "aws_organizations_account" of type "resource"
    Then attribute "iam_user_access_to_billing" equals "ALLOW"

To Reproduce
Steps to reproduce the behavior:

  1. Add the above files
  2. Run clarity
  3. See error

Expected behaviour
The test passes after running clarity account.feature.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: osX
  • Clarity Version: v7.0
  • Terraform Version: v0.14.0

Additional context

I don't believe I am missing a newline, I can confirm I have got a newline at the end of the aws block resource. I have also run terraform fmt to make sure I have not got any formatting issues with the code and that's returned successfully.

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