hcl

Macro block

Source
macro_rules! block {
    ($($block:tt)+) => { ... };
}
Expand description

Construct an hcl::Block from a block identifier, optional block labels and a block body.

For supported syntax see the body! macro documentation.

ยงExample

use hcl::Block;

assert_eq!(
    hcl::block!(
        resource "aws_s3_bucket" "bucket" {
            name = "the-bucket"
        }
    ),
    Block::builder("resource")
        .add_labels(["aws_s3_bucket", "bucket"])
        .add_attribute(("name", "the-bucket"))
        .build(),
);