alicloud_fc_layer_version

Provides a Function Compute Layer Version resource.

For information about FC Layer Version and how to use it, see What is Layer Version.

Example Usage

Basic Usage

provider "alicloud" {
  region = "cn-hangzhou"
}
resource "random_integer" "default" {
  max = 99999
  min = 10000
}
resource "alicloud_oss_bucket" "default" {
  bucket = "terraform-example-${random_integer.default.result}"
}
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
resource "alicloud_oss_bucket_object" "default" {
  bucket  = alicloud_oss_bucket.default.id
  key     = "index.py"
  content = "import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"
}

resource "alicloud_fc_layer_version" "example" {
  layer_name         = "terraform-example-${random_integer.default.result}"
  compatible_runtime = ["python2.7"]
  oss_bucket_name    = alicloud_oss_bucket.default.bucket
  oss_object_name    = alicloud_oss_bucket_object.default.key
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Timeouts

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

Import

Function Compute Layer Version can be imported using the id, e.g.

$ terraform import alicloud_fc_layer_version.example my_function