Releases: xchapter7x/clarity
Releases · xchapter7x/clarity
v0.7.1-rc.2
v0.7.1-rc.2
v0.7.1-rc.1
v0.7.1-rc.1
v0.7.1-rc.0
v0.7.1-rc.0
v0.7.0
Adds support for hcl2
- to leverage hcl2 one needs to swap the
Terraform
in thegiven
clause toHCL2
HCL2 parse test:
-> % ../clarity parsetest.feature
Feature: We should have a LB for our control plane and its components and as
such we should configure the proper security groups and listeners
Scenario: we are using a terraform .11 # parsetest.feature:4
Given Terraform # terraform.go:92 -> *Match
hcl Unmarshal failed: At 13:12: unexpected token while parsing list: IDENT
Scenario: we are using a terraform .12 # parsetest.feature:7
Given HCL2 # terraform.go:102 -> *Match
--- Failed steps:
Scenario: we are using a terraform .11 # parsetest.feature:4
Given Terraform # parsetest.feature:5
Error: hcl Unmarshal failed: At 13:12: unexpected token while parsing list: IDENT
2 scenarios (1 passed, 1 failed)
2 steps (1 passed, 1 failed)
3.094086ms
Sample New Feature HCL2:
terraform {
required_version = ">= 0.12.0"
}
# List of letters
variable "letters" {
description = "a list of letters"
default = ["a", "b", "c"]
}
# Convert letters to upper-case as list
output "upper-case-list" {
value = [for l in var.letters: upper(l)]
}
# Convert letters to upper-case as map
output "upper-case-map" {
value = {for l in var.letters: l => upper(l)}
}
terraform {
required_version = ">= 0.12.0"
}
provider "aws" {
region = "us-east-1"
}
resource "aws_vpc" "my_vpc" {
cidr_block = "172.16.0.0/16"
tags = {
Name = "tf-0.12-for-example"
}
}
resource "aws_subnet" "my_subnet" {
vpc_id = aws_vpc.my_vpc.id
cidr_block = "172.16.10.0/24"
availability_zone = "us-east-1a"
tags = {
Name = "tf-0.12-for-example"
}
}
resource "aws_instance" "ubuntu" {
count = 3
ami = "ami-2e1ef954"
instance_type = "t2.micro"
associate_public_ip_address = ( count.index == 1 ? true : false)
subnet_id = aws_subnet.my_subnet.id
tags = {
Name = format("terraform-0.12-for-demo-%d", count.index)
}
}
# This uses the old splat expression
output "private_addresses_old" {
value = aws_instance.ubuntu.*.private_dns
}
# This uses the new full splat operator (*)
# But this does not work in 0.12 alpha-1 or alpha-2
/*output "private_addresses_full_splat" {
value = [ aws_instance.ubuntu[*].private_dns ]
}*/
# This uses the new for expression
output "private_addresses_new" {
value = [
for instance in aws_instance.ubuntu:
instance.private_dns
]
}
# This uses the new conditional operator
# that can work with lists
# It should work with lists in [x, y, z] form, but does not yet do that
output "ips" {
value = [
for instance in aws_instance.ubuntu:
(instance.public_ip != "" ? list(instance.private_ip, instance.public_ip) : list(instance.private_ip))
]
}
v0.6.2-rc.12
v0.6.2-rc.12
v0.6.2-rc.11
v0.6.2-rc.11
Adds support for hcl2
- to leverage hcl2 one needs to swap the
Terraform
in thegiven
clause toHCL2
v0.6.2-rc.9
v0.6.2-rc.9
v0.6.2-rc.10
v0.6.2-rc.10
v0.6.2-rc.8
v0.6.2-rc.8
v0.6.2-rc.7
v0.6.2-rc.7