Skip to content

Commit

Permalink
Diff suppress storage transfer job start_time_of_day (#3655)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and emilymye committed May 20, 2019
1 parent ba0e969 commit 31aa844
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
6 changes: 0 additions & 6 deletions google/data_source_google_client_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ func dataSourceGoogleClientConfig() *schema.Resource {
Computed: true,
},

"zone": {
Type: schema.TypeString,
Computed: true,
},

"access_token": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -40,7 +35,6 @@ func dataSourceClientConfigRead(d *schema.ResourceData, meta interface{}) error
d.SetId(time.Now().UTC().String())
d.Set("project", config.Project)
d.Set("region", config.Region)
d.Set("zone", config.Zone)

token, err := config.tokenSource.Token()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion google/data_source_google_client_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func TestAccDataSourceGoogleClientConfig_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "project"),
resource.TestCheckResourceAttrSet(resourceName, "region"),
resource.TestCheckResourceAttrSet(resourceName, "zone"),
resource.TestCheckResourceAttrSet(resourceName, "access_token"),
),
},
Expand Down
15 changes: 10 additions & 5 deletions google/resource_storage_transfer_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ func resourceStorageTransferJob() *schema.Resource {
Elem: dateObjectSchema(),
},
"start_time_of_day": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: timeObjectSchema(),
Type: schema.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: timeObjectSchema(),
DiffSuppressFunc: diffSuppressEmptyStartTimeOfDay,
},
},
},
Expand Down Expand Up @@ -301,6 +302,10 @@ func httpDataSchema() *schema.Resource {
}
}

func diffSuppressEmptyStartTimeOfDay(k, old, new string, d *schema.ResourceData) bool {
return k == "schedule.0.start_time_of_day.#" && old == "1" && new == "0"
}

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

Expand Down
2 changes: 0 additions & 2 deletions website/docs/d/datasource_client_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,4 @@ In addition to the arguments listed above, the following attributes are exported

* `region` - The region to operate under.

* `zone` - The zone to operate under.

* `access_token` - The OAuth2 access token used by the client to authenticate against the Google Cloud API.

0 comments on commit 31aa844

Please sign in to comment.