File tree Expand file tree Collapse file tree
test-fixtures/plan-count-index-zero Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2487,6 +2487,29 @@ func TestContextPlan_countIndex(t *testing.T) {
24872487 }
24882488}
24892489
2490+ func TestContextPlan_countIndexZero (t * testing.T ) {
2491+ m := testModule (t , "plan-count-index-zero" )
2492+ p := testProvider ("aws" )
2493+ p .DiffFn = testDiffFn
2494+ ctx := testContext (t , & ContextOpts {
2495+ Module : m ,
2496+ Providers : map [string ]ResourceProviderFactory {
2497+ "aws" : testProviderFuncFixed (p ),
2498+ },
2499+ })
2500+
2501+ plan , err := ctx .Plan (nil )
2502+ if err != nil {
2503+ t .Fatalf ("err: %s" , err )
2504+ }
2505+
2506+ actual := strings .TrimSpace (plan .String ())
2507+ expected := strings .TrimSpace (testTerraformPlanCountIndexZeroStr )
2508+ if actual != expected {
2509+ t .Fatalf ("bad:\n %s" , actual )
2510+ }
2511+ }
2512+
24902513func TestContextPlan_countVar (t * testing.T ) {
24912514 m := testModule (t , "plan-count-var" )
24922515 p := testProvider ("aws" )
Original file line number Diff line number Diff line change @@ -492,6 +492,18 @@ STATE:
492492<no state>
493493`
494494
495+ const testTerraformPlanCountIndexZeroStr = `
496+ DIFF:
497+
498+ CREATE: aws_instance.foo
499+ foo: "" => "0"
500+ type: "" => "aws_instance"
501+
502+ STATE:
503+
504+ <no state>
505+ `
506+
495507const testTerraformPlanCountOneIndexStr = `
496508DIFF:
497509
Original file line number Diff line number Diff line change 1+ resource "aws_instance" "foo" {
2+ foo = " ${ count . index } "
3+ }
You can’t perform that action at this time.
0 commit comments