Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Creating Timer Trigger for Container in Yandex Cloud via Terraform (v0.127.0) #473

Open
jaasco opened this issue Oct 8, 2024 · 1 comment

Comments

@jaasco
Copy link

jaasco commented Oct 8, 2024

Current Version: 0.127.0

Issue Description: According to the documentation, it's possible to create a timer trigger for a container. Using the Yandex Cloud web console it works, but when attempting to create the same trigger using Terraform, an error occurs during deployment.

Steps to Reproduce:

  1. In main.tf, add the following resource:
resource "yandex_function_trigger" "my_trigger" {
  folder_id = var.folder_id
  name      = "my-trigger-name"
  timer {
    cron_expression = "*/15 * ? * * *"
  }
  container {
    id                = container-resource-id
    service_account_id = service-account-id
  }
}
  1. Deploy using Terraform.

Actual

Error: Error while requesting API to create Yandex Cloud Functions Trigger: server-request-id = 1fe58960-c096-4df9-a4db-9e6041316c66 server-trace-id = af9373efb21439cb:9012fe4256058203:af9373efb21439cb:1 client-request-id = 74bab5eb-04c2-434b-b7c8-ea5d98aebbe8 client-trace-id = 87829d54-93dd-4cc2-b37c-450da2a3be81 rpc error: code = InvalidArgument desc = Validation failed:
  - rule.timer.invoke_function.function_id: Field is required

Expected
A timer trigger should be created for the specified container without any errors.

Relative code

It seems that the error appears here:

		if retrySettings != nil || dlqSettings != nil {
			if invokeType == "function" {
				timer.Action = &triggers.Trigger_Timer_InvokeFunctionWithRetry{
					InvokeFunctionWithRetry: getInvokeFunctionWithRetry(),
				}
			} else if invokeType == "container" {
				timer.Action = &triggers.Trigger_Timer_InvokeContainerWithRetry{
					InvokeContainerWithRetry: getInvokeContainerWithRetry(),
				}
			}
		} else {
			timer.Action = &triggers.Trigger_Timer_InvokeFunction{
				InvokeFunction: getInvokeFunctionOnce(),
			}
		}

The else-clause does not account for the case when invokeType is "container", so without the "retry" or "dlq" settings, it only works for functions.

@dmchmk
Copy link
Member

dmchmk commented Nov 1, 2024

Hi! Thanks a lot for your submit, passing the info to the service team to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants