mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-06-29 06:42:36 +00:00
gofmt
This commit is contained in:
parent
9ee9dab9c9
commit
fef7cffaef
|
@ -1,114 +1,114 @@
|
|||
package google
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccComputeInstanceIamBinding(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Parallel()
|
||||
|
||||
project := getTestProjectFromEnv()
|
||||
role := "roles/compute.osLogin"
|
||||
zone := getTestZoneFromEnv()
|
||||
instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(10))
|
||||
project := getTestProjectFromEnv()
|
||||
role := "roles/compute.osLogin"
|
||||
zone := getTestZoneFromEnv()
|
||||
instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeInstanceIamBinding_basic(zone, instanceName, role),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_binding.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s %s", project, zone, instanceName, role),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
{
|
||||
// Test Iam Binding update
|
||||
Config: testAccComputeInstanceIamBinding_update(zone, instanceName, role),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_binding.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s %s", project, zone, instanceName, role),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeInstanceIamBinding_basic(zone, instanceName, role),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_binding.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s %s", project, zone, instanceName, role),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
{
|
||||
// Test Iam Binding update
|
||||
Config: testAccComputeInstanceIamBinding_update(zone, instanceName, role),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_binding.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s %s", project, zone, instanceName, role),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeInstanceIamMember(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Parallel()
|
||||
|
||||
project := getTestProjectFromEnv()
|
||||
role := "roles/compute.osLogin"
|
||||
zone := getTestZoneFromEnv()
|
||||
instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(10))
|
||||
project := getTestProjectFromEnv()
|
||||
role := "roles/compute.osLogin"
|
||||
zone := getTestZoneFromEnv()
|
||||
instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
// Test Iam Member creation (no update for member, no need to test)
|
||||
Config: testAccComputeInstanceIamMember_basic(zone, instanceName, role),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_member.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s %s user:admin@hashicorptest.com", project, zone, instanceName, role),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
// Test Iam Member creation (no update for member, no need to test)
|
||||
Config: testAccComputeInstanceIamMember_basic(zone, instanceName, role),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_member.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s %s user:admin@hashicorptest.com", project, zone, instanceName, role),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeInstanceIamPolicy(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Parallel()
|
||||
|
||||
project := getTestProjectFromEnv()
|
||||
role := "roles/compute.osLogin"
|
||||
zone := getTestZoneFromEnv()
|
||||
instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(10))
|
||||
project := getTestProjectFromEnv()
|
||||
role := "roles/compute.osLogin"
|
||||
zone := getTestZoneFromEnv()
|
||||
instanceName := fmt.Sprintf("tf-test-instance-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeInstanceIamPolicy_basic(zone, instanceName, role),
|
||||
},
|
||||
// Test a few import formats
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_policy.foo",
|
||||
ImportStateId: fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, zone, instanceName),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_policy.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s", project, zone, instanceName),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_policy.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s", zone, instanceName),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeInstanceIamPolicy_basic(zone, instanceName, role),
|
||||
},
|
||||
// Test a few import formats
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_policy.foo",
|
||||
ImportStateId: fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, zone, instanceName),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_policy.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s/%s", project, zone, instanceName),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_instance_iam_policy.foo",
|
||||
ImportStateId: fmt.Sprintf("%s/%s", zone, instanceName),
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccComputeInstanceIamMember_basic(zone, instanceName, roleId string) string {
|
||||
return fmt.Sprintf(`
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_instance" "test_vm" {
|
||||
zone = "%s"
|
||||
name = "%s"
|
||||
|
@ -137,7 +137,7 @@ func testAccComputeInstanceIamMember_basic(zone, instanceName, roleId string) st
|
|||
}
|
||||
|
||||
func testAccComputeInstanceIamPolicy_basic(zone, instanceName, roleId string) string {
|
||||
return fmt.Sprintf(`
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_instance" "test_vm" {
|
||||
zone = "%s"
|
||||
name = "%s"
|
||||
|
@ -172,7 +172,7 @@ func testAccComputeInstanceIamPolicy_basic(zone, instanceName, roleId string) st
|
|||
}
|
||||
|
||||
func testAccComputeInstanceIamBinding_basic(zone, instanceName, roleId string) string {
|
||||
return fmt.Sprintf(`
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_instance" "test_vm" {
|
||||
zone = "%s"
|
||||
name = "%s"
|
||||
|
@ -201,7 +201,7 @@ func testAccComputeInstanceIamBinding_basic(zone, instanceName, roleId string) s
|
|||
}
|
||||
|
||||
func testAccComputeInstanceIamBinding_update(zone, instanceName, roleId string) string {
|
||||
return fmt.Sprintf(`
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_instance" "test_vm" {
|
||||
zone = "%s"
|
||||
name = "%s"
|
||||
|
|
Loading…
Reference in New Issue
Block a user