Skip to content

Commit

Permalink
scheduler: fix perm diff on appEngineRouting
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
tmshn authored and modular-magician committed Sep 12, 2019
1 parent 1befeb8 commit f4960dc
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions google-beta/resource_cloud_scheduler_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,33 +634,17 @@ func flattenCloudSchedulerJobAppEngineHttpTargetHttpMethod(v interface{}, d *sch
return v
}

// An `appEngineRouting` filed of CloudScheduler API only contains output-only `host` field,
// so we set config values rather than api response to state.
// https://cloud.google.com/scheduler/docs/reference/rest/v1/projects.locations.jobs#AppEngineRouting
func flattenCloudSchedulerJobAppEngineHttpTargetAppEngineRouting(v interface{}, d *schema.ResourceData) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
if targets := d.Get("app_engine_http_target").([]interface{}); len(targets) > 0 {
return targets[0].(map[string]interface{})["app_engine_routing"]
}
transformed := make(map[string]interface{})
transformed["service"] =
flattenCloudSchedulerJobAppEngineHttpTargetAppEngineRoutingService(original["service"], d)
transformed["version"] =
flattenCloudSchedulerJobAppEngineHttpTargetAppEngineRoutingVersion(original["version"], d)
transformed["instance"] =
flattenCloudSchedulerJobAppEngineHttpTargetAppEngineRoutingInstance(original["instance"], d)
return []interface{}{transformed}
}
func flattenCloudSchedulerJobAppEngineHttpTargetAppEngineRoutingService(v interface{}, d *schema.ResourceData) interface{} {
return v
}

func flattenCloudSchedulerJobAppEngineHttpTargetAppEngineRoutingVersion(v interface{}, d *schema.ResourceData) interface{} {
return v
}

func flattenCloudSchedulerJobAppEngineHttpTargetAppEngineRoutingInstance(v interface{}, d *schema.ResourceData) interface{} {
return v
return nil
}

func flattenCloudSchedulerJobAppEngineHttpTargetRelativeUri(v interface{}, d *schema.ResourceData) interface{} {
Expand Down

0 comments on commit f4960dc

Please sign in to comment.