Adding a trigger label in Cloud Functions
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To add a label to a trigger, run the command:
yc serverless trigger add-labels <trigger_name> --labels <key>=<value>
Result:
id: a1s9q2li6t**********
folder_id: b1g9hv2loa**********
created_at: "2023-08-01T12:36:14.321Z"
name: my-trigger
description: Trigger for uploaded objects
labels:
version: beta
rule:
object_storage:
event_type:
- OBJECT_STORAGE_EVENT_TYPE_CREATE_OBJECT
bucket_id: **********
batch_settings:
size: "10"
cutoff: 10s
invoke_function:
function_id: d4e5muirrt**********
function_tag: $latest
service_account_id: ajek0fou8e**********
status: ACTIVE
For more information about Terraform, see the documentation.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
To add a trigger label:
-
Open the Terraform configuration file and add the
labelssection to the trigger description:... resource "yandex_function_trigger" "my_trigger" { name = "some_name" labels = { tf-label = "tf-label-value" empty-label = "" } description = "any description" timer { cron_expression = "* * * * ? *" } function { id = "tf-test" } } ...For more information about the
yandex_function_triggerresource parameters in Terraform, see the provider documentation. -
Check the configuration using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planThe terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply -
Confirm the changes: type
yesinto the terminal and press Enter.You can check the trigger update using this CLI command:
yc serverless trigger get <trigger_ID>
To add a trigger label, use the update REST API method for the Trigger resource or the TriggerService/Update gRPC API call.