Skip to content

Commit

Permalink
[Terraform]: Remove google_cloudfunctions_function.retry_on_failure (#…
Browse files Browse the repository at this point in the history
…668)

Merged PR #668.
  • Loading branch information
rileykarson authored and modular-magician committed Nov 2, 2018
1 parent eedca7a commit f610e92
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 30 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
30 changes: 5 additions & 25 deletions provider/terraform/resources/resource_cloudfunctions_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func resourceCloudFunctionsFunction() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Computed: true,
ConflictsWith: []string{"trigger_http", "retry_on_failure", "trigger_topic", "trigger_http"},
ConflictsWith: []string{"trigger_http"},
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -245,11 +245,10 @@ func resourceCloudFunctionsFunction() *schema.Resource {
},

"retry_on_failure": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Deprecated: "This field is deprecated. Use `event_trigger.failure_policy.retry` instead.",
ConflictsWith: []string{"trigger_http"},
Type: schema.TypeBool,
Optional: true,
Computed: true,
Removed: "This field is removed. Use `event_trigger.failure_policy.retry` instead.",
},

"project": {
Expand Down Expand Up @@ -404,12 +403,6 @@ func resourceCloudFunctionsRead(d *schema.ResourceData, meta interface{}) error
}

d.Set("event_trigger", flattenEventTrigger(function.EventTrigger))
if function.EventTrigger != nil {
if _, ok := d.GetOk("retry_on_failure"); ok {
retry := function.EventTrigger.FailurePolicy != nil && function.EventTrigger.FailurePolicy.Retry != nil
d.Set("retry_on_failure", retry)
}
}

d.Set("region", cloudFuncId.Region)
d.Set("project", cloudFuncId.Project)
Expand Down Expand Up @@ -476,19 +469,6 @@ func resourceCloudFunctionsUpdate(d *schema.ResourceData, meta interface{}) erro
updateMaskArr = append(updateMaskArr, "environment_variables")
}

// Event trigger will run after failure policy and take precedence
if d.HasChange("retry_on_failure") {
if d.Get("retry_on_failure").(bool) {
if function.EventTrigger == nil {
function.EventTrigger = &cloudfunctions.EventTrigger{}
}
function.EventTrigger.FailurePolicy = &cloudfunctions.FailurePolicy{
Retry: &cloudfunctions.Retry{},
}
}
updateMaskArr = append(updateMaskArr, "eventTrigger.failurePolicy.retry")
}

if d.HasChange("event_trigger") {
function.EventTrigger = expandEventTrigger(d.Get("event_trigger").([]interface{}), project)
updateMaskArr = append(updateMaskArr, "eventTrigger", "eventTrigger.failurePolicy.retry")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ The following arguments are supported:

* `environment_variables` - (Optional) A set of key/value environment variable pairs to assign to the function.

* `retry_on_failure` - (Optional) Whether the function should be retried on failure. This only applies to bucket and topic triggers, not HTTPS triggers.
Deprecated. Use `event_trigger.failure_policy.retry` instead.

The `event_trigger` block supports:

* `event_type` - (Required) The type of event to observe. For example: `"providers/cloud.storage/eventTypes/object.change"`
Expand Down

0 comments on commit f610e92

Please sign in to comment.