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