Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

Description

The github-runner-label tag contains GitHub Actions template syntax ${{ github.run_id }} with curly braces, causing AWS CodeBuild to reject the tag with InvalidInputException. AWS CodeBuild tags only support: letters, numbers, spaces, and _ . : / = + - @.

Related Issues

Fixes #[issue_number]

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Configuration change
  • ♻️ Code refactoring
  • ⚡ Performance improvement
  • ✅ Test addition or update
  • 🔒 Security improvement

Changes Made

  • Removed automatic github-runner-label tag from CodeBuild projects in locals.tf
  • Runner label remains visible in CodeBuild project description (description field accepts any characters)
  • Updated README.md to reflect tag removal

Before:

tags = merge(var.tags, {
  github-runner-label = "codebuild-${var.name}-$${{ github.run_id }}-$${{ github.run_attempt }}"
})

After:

tags = var.tags

Testing

  • Pre-commit hooks passed (pre-commit run -a)
  • Terraform format checked (terraform fmt -recursive)
  • Terraform validation passed (terraform validate)
  • Examples tested
  • Security scans passed (tfsec, checkov, trivy)

Test Configuration

Not applicable - this is a tag removal fix.

Documentation

  • Updated README.md (or documentation auto-generated via terraform-docs)
  • Updated relevant example configurations
  • Added/updated comments in code where necessary
  • Updated CHANGELOG.md (or will be auto-generated)

Security

  • No secrets or credentials are committed
  • Security scanning tools passed (checkov, tfsec, trivy)
  • IAM policies follow principle of least privilege
  • Security implications have been considered and documented

Breaking Changes

None. The auto-generated tag was not documented as a feature and caused errors when present.

Screenshots / Examples

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have updated the documentation accordingly
  • My commit messages follow the Conventional Commits specification

Additional Notes

Users retain full control over CodeBuild tags via the tags variable. The runner label format remains unchanged and is still accessible in the CodeBuild project description for reference.


By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: CodeBuild tags are using invalid characters</issue_title>
<issue_description>### Description

The terraform apply is failing because the github-runner-label tag contains invalid characters. The tag value is:

"codebuild-my-runner-${{ github.run_id }}-${{ github.run_attempt }}"

The ${{ }} syntax (GitHub Actions template syntax) contains curly braces {} which are not allowed in AWS CodeBuild tags. AWS CodeBuild tags can only contain: letters, numbers, spaces, and _ . : / = + - @

Expected Behavior

The automatically generated tags should not include the runner label by default

Actual Behavior

Error: updating CodeBuild Project (arn:aws:codebuild:af-south-1:123456123456:project/my-runner): operation error CodeBuild: UpdateProject, https response error StatusCode: 400, ..., InvalidInputException: The tags do not meet the acceptance criteria: Tags can only contain letters, numbers, spaces, and the following special characters: _ . : / = + - @

Steps to Reproduce

Deploy module

Terraform Configuration

a

Module Version

latest

Terraform Version

1.5.7

AWS Provider Version

6

AWS Region

us-east-1

Error Messages / Logs

Additional Context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@baolsen baolsen marked this pull request as ready for review November 17, 2025 12:46
@baolsen baolsen self-requested a review as a code owner November 17, 2025 12:46
Copilot AI changed the title [WIP] Fix invalid characters in CodeBuild tags fix: remove github-runner-label tag containing invalid characters Nov 17, 2025
@baolsen baolsen merged commit c0ff21f into main Nov 17, 2025
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CodeBuild tags are using invalid characters

2 participants