diff options
| author | mo khan <mo@mokhan.ca> | 2021-06-06 16:22:14 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2021-06-06 16:22:14 -0600 |
| commit | df10720292a96e76d4f839ba9c5726f63c4c5dc1 (patch) | |
| tree | 3cf890679e6799ecbda898f1ec9eb50d661417ad | |
| parent | 4b8378171687ca1343888d9836cf5489aa4d2f2d (diff) | |
test: add pending specs for parsing different types of resources and modules
| -rw-r--r-- | spec/parser_spec.rb | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb index 5f503ad..c8d50fc 100644 --- a/spec/parser_spec.rb +++ b/spec/parser_spec.rb @@ -124,6 +124,89 @@ RSpec.describe Hcl2::Parser do ]) end end + + context "when parsing a module with a git source" do + let(:content) do + <<~HCL + module "origin_label" { + source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.7" + } + HCL + end + + pending { expect(subject).to be_truthy } + end + + context "when parsing a module with an argument assignment via string interpolation" do + let(:content) do + <<~HCL + module "origin_label" { + namespace = "${var.namespace}" + } + HCL + end + + pending { expect(subject).to be_truthy } + end + + context "when parsing a module with an argument assigned to a single line array declaration" do + let(:content) do + <<~HCL + module "origin_label" { + attributes = ["${compact(concat(var.attributes, list("origin")))}"] + } + HCL + end + + pending { expect(subject).to be_truthy } + end + + context "when parsing a resource with multiple names" do + let(:content) do + <<~HCL + resource "aws_cloudfront_origin_access_identity" "default" { + comment = "${module.distribution_label.id}" + } + HCL + end + + pending { expect(subject).to be_truthy } + end + + context "when parsing a resource with a nested block" do + let(:content) do + <<~HCL + resource "aws_cloudfront_distribution" "default" { + enabled = "${var.enabled}" + is_ipv6_enabled = "${var.is_ipv6_enabled}" + comment = "${var.comment}" + default_root_object = "${var.default_root_object}" + price_class = "${var.price_class}" + + logging_config = { + include_cookies = "${var.log_include_cookies}" + bucket = "${module.logs.bucket_domain_name}" + prefix = "${var.log_prefix}" + } + } + HCL + end + + pending { expect(subject).to be_truthy } + end + + context "when parsing a resource with an assignment to another variable" do + let(:content) do + <<~HCL + module "distribution_label" { + source = "bitbucket.org/cloudposse/terraform-null-label.git" + namespace = var.namespace + } + HCL + end + + pending { expect(subject).to be_truthy } + end end describe "#version_assignment" do |
