Skip to content

Commit

Permalink
Add empty binding test to generated
Browse files Browse the repository at this point in the history
  • Loading branch information
slevenick committed Sep 24, 2019
1 parent abeb2a7 commit 8e19c1f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions templates/terraform/examples/base_configs/iam_test_file.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ func TestAcc<%= resource_name -%>IamPolicyGenerated(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAcc<%= resource_name -%>IamPolicy_emptyBinding(context),
},
{
ResourceName: "<%= resource_ns_iam -%>_policy.foo",
ImportStateId: fmt.Sprintf("<%= import_url -%>"<% unless import_qualifiers.empty? -%>, <% end -%><%= import_qualifiers.join(', ') -%>, <%= example.primary_resource_name -%>),
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down Expand Up @@ -150,6 +159,20 @@ resource "<%= resource_ns_iam -%>_policy" "foo" {
`, context)
}

func testAcc<%= resource_name -%>IamPolicy_emptyBinding(context map[string]interface{}) string {
return Nprintf(`
<%= example.config_test_body -%>

data "google_iam_policy" "foo" {
}

resource "<%= resource_ns_iam -%>_policy" "foo" {
<%= lines(compile('templates/terraform/iam/iam_attributes.go.erb')) -%>
policy_data = "${data.google_iam_policy.foo.policy_data}"
}
`, context)
}

func testAcc<%= resource_name -%>IamBinding_basicGenerated(context map[string]interface{}) string {
return Nprintf(`
<%= example.config_test_body -%>
Expand Down

0 comments on commit 8e19c1f

Please sign in to comment.