Skip to content

Commit

Permalink
fix zone expand
Browse files Browse the repository at this point in the history
  • Loading branch information
emilymye committed Sep 10, 2018
1 parent 5ee6127 commit 43c2e93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions google/resource_composer_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,9 @@ func expandComposerEnvironmentServiceAccount(v interface{}, d *schema.ResourceDa

func expandComposerEnvironmentZone(v interface{}, d *schema.ResourceData, config *Config) (string, error) {
zone := v.(string)
if len(zone) == 0 {
return zone, nil
}
if !strings.Contains(zone, "/") {
project, err := getProject(d, config)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions google/resource_composer_environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,11 @@ func testSweepComposerEnvironmentBuckets(config *Config) error {
// but will not remove them when the Environment is deleted.
//
// Destroy test step for config with a network will fail unless we clean up the firewalls before.
func testAccCheckClearComposerEnvironmentFirewalls(network string) resource.TestCheckFunc {
func testAccCheckClearComposerEnvironmentFirewalls(networkName string) resource.TestCheckFunc {
return func(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
config.Project = getTestProjectFromEnv()
network, err := config.clientCompute.Networks.Get(getTestProjectFromEnv(), network).Do()
network, err := config.clientCompute.Networks.Get(getTestProjectFromEnv(), networkName).Do()
if err != nil {
return err
}
Expand All @@ -486,6 +486,7 @@ func testAccCheckClearComposerEnvironmentFirewalls(network string) resource.Test

var allErrors error
for _, firewall := range foundFirewalls.Items {
log.Printf("[DEBUG] Deleting firewall %q for test-resource network %q", firewall.Name, network.Name)
op, err := config.clientCompute.Firewalls.Delete(config.Project, firewall.Name).Do()
if err != nil {
allErrors = multierror.Append(allErrors,
Expand Down

0 comments on commit 43c2e93

Please sign in to comment.