Updating a trigger label in Cloud Functions
If you don't have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To update a trigger label, run the command:
Warning
The existing set of labels
is completely replaced by the set transmitted.
yc serverless trigger update <trigger name> --labels <key>=<value>
Result:
id: dd0gj5tsj2**********
folder_id: aoek49ghmk**********
created_at: "2019-08-28T12:26:25.675Z"
name: my-trigger
description: My YMQ trigger.
labels:
new_labels: my-beta-trigger
rule:
message_queue:
queue_id: yrn:yc:ymq:ru-central1:aoek49ghmk**********:my-mq
service_account_id: bfbqqeo6jk**********
batch_settings:
size: "10"
cutoff: 10s
invoke_function:
function_id: b09e5lu91t**********
function_tag: $latest
service_account_id: bfbqqeo6jk**********
status: ACTIVE
You can update a trigger label using the update API method.
For more information about Terraform, see the documentation.
With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it by configuration files. They store the infrastructure description in HashiCorp Configuration Language (HCL). Terraform and its providers are distributed under the Mozilla Public License.
For more information about the provider resources, see the documentation on the Terraform site or mirror site.
If you change the configuration files, Terraform automatically determines which part of your configuration is already deployed and what should be added or removed.
To change a trigger label:
-
Open the Terraform configuration file and change the
labels
section in 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_trigger
resource parameters in Terraform, see the provider documentation. -
Check the configuration using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can verify the change to the trigger using this CLI command:
yc serverless trigger get <trigger ID>