文档

alicloud_fcv3_async_invoke_config

更新时间:
一键部署

Provides a FCV3 Async Invoke Config resource.

Function Asynchronous Configuration.

For information about FCV3 Async Invoke Config and how to use it, see What is Async Invoke Config.

-> NOTE: Available since v1.228.0.

Example Usage

Basic Usage


variable "name" {
  default = "terraform-example"
}

provider "alicloud" {
  region = "eu-central-1"
}

data "alicloud_account" "current" {
}

resource "alicloud_fcv3_function" "function" {
  memory_size = "512"
  cpu         = 0.5
  handler     = "index.Handler"
  code {
    zip_file = "UEsDBBQACAAIAAAAAAAAAAAAAAAAAAAAAAAIAAAAaW5kZXgucHmEkEFKxEAQRfd9ig9ZTCJOooIwDMwNXLqXnnQlaalUhU5lRj2KZ/FOXkESGR114bJ/P/7jV4b1xRq1hijtFpM1682cuNgPmgysbRulPT0fRxXnMtwrSPyeCdYRokSLnuMLJTTkbUqEvDMbxm1VdcRD6Tk+T1LW2ldB66knsYdA5iNX17ebm6tN2VnPhcswMPmREPuBacb+CiapLarAj9gT6/H97dVlCNScY3mtYvRkxdZlwDKDEnanPWVLdrdkeXEGlFEazVdfPVHaVeHc3N15CUwppwOJXeK7HshAB8NuOU7J6sP4SRXuH/EvbUfMiqMmDqv5M5FNSfAj/wgAAP//UEsHCPl//NYAAQAArwEAAFBLAQIUABQACAAIAAAAAAD5f/zWAAEAAK8BAAAIAAAAAAAAAAAAAAAAAAAAAABpbmRleC5weVBLBQYAAAAAAQABADYAAAA2AQAAAAA="
  }
  function_name = var.name
  runtime       = "python3.9"
  disk_size     = "512"
  log_config {
    log_begin_rule = "None"
  }
}

resource "alicloud_fcv3_function" "function1" {
  memory_size = "512"
  cpu         = 0.5
  handler     = "index.Handler"
  code {
    zip_file = "UEsDBBQACAAIAAAAAAAAAAAAAAAAAAAAAAAIAAAAaW5kZXgucHmEkEFKxEAQRfd9ig9ZTCJOooIwDMwNXLqXnnQlaalUhU5lRj2KZ/FOXkESGR114bJ/P/7jV4b1xRq1hijtFpM1682cuNgPmgysbRulPT0fRxXnMtwrSPyeCdYRokSLnuMLJTTkbUqEvDMbxm1VdcRD6Tk+T1LW2ldB66knsYdA5iNX17ebm6tN2VnPhcswMPmREPuBacb+CiapLarAj9gT6/H97dVlCNScY3mtYvRkxdZlwDKDEnanPWVLdrdkeXEGlFEazVdfPVHaVeHc3N15CUwppwOJXeK7HshAB8NuOU7J6sP4SRXuH/EvbUfMiqMmDqv5M5FNSfAj/wgAAP//UEsHCPl//NYAAQAArwEAAFBLAQIUABQACAAIAAAAAAD5f/zWAAEAAK8BAAAIAAAAAAAAAAAAAAAAAAAAAABpbmRleC5weVBLBQYAAAAAAQABADYAAAA2AQAAAAA="
  }
  function_name = format("%s_%s", var.name, "update1")
  runtime       = "python3.9"
  disk_size     = "512"
  log_config {
    log_begin_rule = "None"
  }
}

resource "alicloud_fcv3_function" "function2" {
  memory_size = "512"
  cpu         = 0.5
  handler     = "index.Handler"
  code {
    zip_file = "UEsDBBQACAAIAAAAAAAAAAAAAAAAAAAAAAAIAAAAaW5kZXgucHmEkEFKxEAQRfd9ig9ZTCJOooIwDMwNXLqXnnQlaalUhU5lRj2KZ/FOXkESGR114bJ/P/7jV4b1xRq1hijtFpM1682cuNgPmgysbRulPT0fRxXnMtwrSPyeCdYRokSLnuMLJTTkbUqEvDMbxm1VdcRD6Tk+T1LW2ldB66knsYdA5iNX17ebm6tN2VnPhcswMPmREPuBacb+CiapLarAj9gT6/H97dVlCNScY3mtYvRkxdZlwDKDEnanPWVLdrdkeXEGlFEazVdfPVHaVeHc3N15CUwppwOJXeK7HshAB8NuOU7J6sP4SRXuH/EvbUfMiqMmDqv5M5FNSfAj/wgAAP//UEsHCPl//NYAAQAArwEAAFBLAQIUABQACAAIAAAAAAD5f/zWAAEAAK8BAAAIAAAAAAAAAAAAAAAAAAAAAABpbmRleC5weVBLBQYAAAAAAQABADYAAAA2AQAAAAA="
  }
  function_name = format("%s_%s", var.name, "update2")
  runtime       = "python3.9"
  disk_size     = "512"
  log_config {
    log_begin_rule = "None"
  }
}

resource "alicloud_fcv3_async_invoke_config" "default" {
  max_async_retry_attempts       = "1"
  max_async_event_age_in_seconds = "1"
  async_task                     = "true"
  function_name                  = alicloud_fcv3_function.function.function_name
  destination_config {
    on_failure {
      destination = "acs:fc:eu-central-1:${data.alicloud_account.current.id}:functions/${alicloud_fcv3_function.function1.function_name}"
    }

    on_success {
      destination = "acs:fc:eu-central-1:${data.alicloud_account.current.id}:functions/${alicloud_fcv3_function.function1.function_name}"
    }

  }

  qualifier = "LATEST"
}

Argument Reference

The following arguments are supported:

  • async_task - (Optional) Whether to enable an asynchronous task
  • destination_config - (Optional) Target Configuration See destination_config below.
  • function_name - (Required, ForceNew) Function Name
  • max_async_event_age_in_seconds - (Optional) Event maximum survival time
  • max_async_retry_attempts - (Optional) Number of Asynchronous call retries
  • qualifier - (Optional) Function version or alias

destination_config

The destination_config supports the following:

  • on_failure - (Optional) Failed callback target structure. See on_failure below.
  • on_success - (Optional) Successful callback target structure. See on_success below.

destination_config-on_failure

The destination_config-on_failure supports the following:

  • destination - (Optional) Asynchronous call target Resource Descriptor.

destination_config-on_success

The destination_config-on_success supports the following:

  • destination - (Optional) Asynchronous call target Resource Descriptor.

Attributes Reference

The following attributes are exported:

  • id - The ID of the resource supplied above.
  • create_time - The creation time of the resource

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 5 mins) Used when create the Async Invoke Config.
  • delete - (Defaults to 5 mins) Used when delete the Async Invoke Config.
  • update - (Defaults to 5 mins) Used when update the Async Invoke Config.

Import

FCV3 Async Invoke Config can be imported using the id, e.g.

$ terraform import alicloud_fcv3_async_invoke_config.example <id>