Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
slevenick committed Oct 25, 2019
1 parent 5b67e98 commit fa620e3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ func dataSourceGoogleComputeNetworkEndpointGroup() *schema.Resource {
func dataSourceComputeNetworkEndpointGroupRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
if name, ok := d.GetOk("name"); ok {
project, err := getProject(d, config)
if err != nil {
return err
}
zone, err := getZone(d, config)
if err != nil {
return err
}
d.SetId(fmt.Sprintf("%s/%s", zone, name.(string)))
d.SetId(fmt.Sprintf("projects/%s/zones/%s/networkEndpointGroups/%s", project, zone, name.(string)))
} else if selfLink, ok := d.GetOk("self_link"); ok {
parsed, err := ParseNetworkEndpointGroupFieldValue(selfLink.(string), d, config)
if err != nil {
Expand All @@ -38,7 +42,7 @@ func dataSourceComputeNetworkEndpointGroupRead(d *schema.ResourceData, meta inte
d.Set("name", parsed.Name)
d.Set("zone", parsed.Zone)
d.Set("project", parsed.Project)
d.SetId(fmt.Sprintf("projects/%s/zones/%s/networkEndpointGroups/%s", parsed.Zone, parsed.Name))
d.SetId(fmt.Sprintf("projects/%s/zones/%s/networkEndpointGroups/%s", parsed.Project, parsed.Zone, parsed.Name))
} else {
return errors.New("Must provide either `self_link` or `zone/name`")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package google
import (
"fmt"
"regexp"
"strconv"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func dataSourceGoogleComputeBackendService() *schema.Resource {
}

func dataSourceComputeBackendServiceRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

serviceName := d.Get("name").(string)

project, err := getProject(d, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package google

import (
"fmt"
"strconv"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package google
import (
"fmt"
"log"
"strconv"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func dataSourceGoogleComputeSslCertificate() *schema.Resource {
}

func dataSourceComputeSslCertificateRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

project, err := getProject(d, config)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package google

import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

Expand All @@ -21,6 +23,8 @@ func dataSourceGoogleComputeSslPolicy() *schema.Resource {
}

func datasourceComputeSslPolicyRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

project, err := getProject(d, config)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func dataSourceGoogleContainerCluster() *schema.Resource {
}

func datasourceContainerClusterRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

clusterName := d.Get("name").(string)

location, err := getLocation(d, config)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package google

import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

Expand All @@ -21,7 +22,7 @@ func datasourceGoogleProjectRead(d *schema.ResourceData, meta interface{}) error

if v, ok := d.GetOk("project_id"); ok {
project := v.(string)
d.SetId(project)
d.SetId(fmt.Sprintf("projects/%s", project))
} else {
project, err := getProject(d, config)
if err != nil {
Expand Down

0 comments on commit fa620e3

Please sign in to comment.