Failing to locate trigger on update/delete operations
nrccua-grante opened this issue · comments
First, thank you very much for building this provider.
Was able to create a project with associated resources just fine, however, hit an error on the next apply. This kills the apply and is a blocker for us.
The Error is:
Error: 404 Not Found - Trigger (id: RQ_40) for buildTypeId (id: LambdaFunctions_MyLambdaMyLambdaDevO) was not found
Have a suspicion this may be due to our Team City version being very old (we're on a version from 2016), confirmation of this would help my upgrade case.
Currently testing a workaround where we don't deploy the vcs trigger via terraform.
our terraforms for this project:
data "teamcity_project" "lambda_root" {
provider = "teamcity"
name = "Lambda Functions"
}
# step 2, build the project for this lambda,
resource "teamcity_project" "my_lambda_project" {
provider = "teamcity"
name = "My Lambda"
parent_id = data.teamcity_project.datalab_lambda_root.id
description = "Parent Project for the My Lambda Lambdas"
}
# Step 3, get the credentials for the CI automation role for the environment.
data "aws_ssm_parameter" "ci_access_key" {
provider = "aws.va"
name = "/something/secrets/env/shared_secrets/myrole.deployment.dev-service/access_key"
}
data "aws_ssm_parameter" "ci_secret_key" {
provider = "aws.va"
name = "/something/secrets/env/shared_secrets/myrole.deployment.dev-service/secret_key"
}
# step 4, setup the project for this lambda integration
# note some these values need hardcoded, since we can't deploy the lambda without the deployment artifact and we can't build that without teamcity. catch 22.
resource "teamcity_project" "my_lambda_lambda" {
provider = "teamcity"
name = "My Lambda Lambda - Dev"
parent_id = teamcity_project.my_lambda_project.id
description = "My Lambda Lambda - Dev"
env_params = {
AWS_ACCESS_KEY_ID = data.aws_ssm_parameter.ci_access_key.value
AWS_SECRET_ACCESS_KEY = data.aws_ssm_parameter.ci_secret_key.value
AWS_DEFAULT_REGION = "us-east-1"
DEPLOYMENT_BUCKET = "blah-deployment-artifacts-dev.us-east-1"
ENVIRONMENT = "dev"
PRODUCT = "blah"
FUNCTION_NAME = "my_lambda"
ROLE = "tf-my_lambda-dev-execute"
}
}
#step 5, setup version control integration.
#5a - setup the git stuff here, we re-use later
locals {
url_root = "https://github.com/myorg/my-lambda"
branch = "development"
}
# 5b - setup the git branch for this project
resource "teamcity_vcs_root_git" "vcs_integration" {
provider = "teamcity"
name = "${local.url_root}#refs/heads/${local.branch}" #vcs_root_name
project_id = teamcity_project.my_lambda_lambda.id
fetch_url = local.url_root
push_url = local.url_root
default_branch = "refs/heads/${local.branch}"
enable_branch_spec_tags = false
username_style = "userid"
submodule_checkout = "checkout"
// Configure agent settings
agent {
git_path = "/usr/bin/git"
clean_policy = "branch_change"
clean_files_policy = "untracked"
use_mirrors = true
}
// credentials for TeamCity to access git
auth {
type = "userpass"
username = "blah-ci-automation"
password = data.aws_ssm_parameter.git_ci_automation.value
}
}
# step 6 - build steps
resource "teamcity_build_config" "teamcity_build" {
provider = "teamcity"
# project ID in this context is the environment specific project for this lambda
project_id = "${teamcity_project.my_lambda_lambda.id}"
name = "${local.product}-${local.service}-${local.environment}-TC-Build"
vcs_root {
id = teamcity_vcs_root_git.vcs_integration.id
checkout_rules = ["+:*"]
}
settings {
#Type of build configuration: "REGULAR" (default), "COMPOSITE" or "DEPLOYMENT"
configuration_type = "REGULAR"
#The format may include '%build.counter%' as a placeholder for the build counter value, for example, 1.%build.counter%.
#It may also contain a reference to any other available parameter, for example, %build.vcs.number.VCSRootName%.
#Note: The maximum length of a build number after all substitutions is 256 characters.
build_number_format = "%build.counter%"
#Positive int
build_counter = 1
#Set to false to disable personal builds. Default: true
allow_personal_builds = true
#Paths in the form of [+:]source [ => target] to include and -:source [ => target] to exclude files or directories to publish as build artifacts.
artifact_paths = []
#Enable hanging builds detection. Default: true
detect_hanging = true
#Enable build status to be queried externally. Default: false
status_widget = false
#Int 0->unlimited. Defaults to '0', which means unlimited.
concurrent_limit = 2
}
# for simple not paramaterized stuff, inline is fine, for heavy code or code with params, use a file.
# the order of these determines the order of operations in the build
step {
name = "NPM Install"
type = "cmd_line"
code = file("${path.module}/teamcity_build_scripts/npm.sh")
}
step {
name = "Zipper"
type = "cmd_line"
code = file("${path.module}/teamcity_build_scripts/zipper.sh")
}
step {
name = "Deployment"
type = "cmd_line"
code = file("${path.module}/teamcity_build_scripts/deployment.sh")
}
step {
name = "Cleanup"
type = "cmd_line"
code = file("${path.module}/teamcity_build_scripts/cleanup.sh")
}
}
resource "teamcity_build_trigger_vcs" "teamcity_vcs_trigger" {
build_config_id = teamcity_build_config.teamcity_build.id
rules = ["+:."]
branch_filter = ["development"]
}
resource "teamcity_agent_requirement" "agents" {
provider = "teamcity"
build_config_id = "${teamcity_build_config.teamcity_build.id}"
condition = "contains"
name = "teamcity.agent.name"
value = "MY_AGENT"
}
Hi @nrccua-grante , given my limited bandwidth it is impractical to support several (specially older) versions of TeamCity.
The minimum version when I've started developing the client API library was 2007.1
.
Keeping the provider and the underlying library backwards compatible to previous versions would be an overhead that I can't commit to.
@nrccua-grante Do you have the exact version of the TeamCity this is happening? If there's a docker image for it, we may be able to reproduce.
Otherwise, I'll close this issue due to inactivity, thanks!
Closing as stale / no response.