Open thiagonache opened 3 years ago
I want to reduce the paperwork required to run a test. Eg.:
tfPlan, err := terraformtest.ReadPlan("./mymodule.plan.json") if err != nil { t.Fatalf("Cannot read plan file ./mymodule.plan.json: %v", err) } wantResource := terraformtest.Resource{ Address: "module.vpc.aws_vpc.this[0]", Metadata: map[string]string{ "type": "aws_vpc", "name": "this", }, Values: map[string]string{ "enable_dns_hostnames": "true", "enable_dns_support": "true", "assign_generated_ipv6_cidr_block": "false", "cidr_block": "10.0.0.0/16", "instance_tenancy": "default", }, } gotRS := tfPlan.Resources if !gotRS.Contains(wantResource) { t.Error(gotRS.Diff()) }
Could be simplified to
wantResource := terraformtest.Resource{ Address: "module.vpc.aws_vpc.this[0]", Metadata: map[string]string{ "type": "aws_vpc", "name": "this", }, Values: map[string]string{ "enable_dns_hostnames": "true", "enable_dns_support": "true", "assign_generated_ipv6_cidr_block": "false", "cidr_block": "10.0.0.0/16", "instance_tenancy": "default", }, } r := terraformtest.New( terraformtest.WithPlanFile("./mymodule.plan.json") ) terraformtest.Contains(wantResource)
I'll check this issue.
I want to reduce the paperwork required to run a test. Eg.:
Could be simplified to