Skip to content

fix(gcp*): enforce string type for project_id in YAML templates - #14765

Merged
andrewkroh merged 3 commits into
elastic:mainfrom
andrewkroh:gcp/fix/string-project-id
Aug 15, 2025
Merged

fix(gcp*): enforce string type for project_id in YAML templates#14765
andrewkroh merged 3 commits into
elastic:mainfrom
andrewkroh:gcp/fix/string-project-id

Conversation

@andrewkroh

Copy link
Copy Markdown
Contributor

Proposed commit message

This change adds explicit YAML string type casting using the !!str tag to the project_id field across all GCP data stream template files. The modification ensures that project identifiers are parsed as string values in the generated YAML configuration, preventing potential issues that could arise from numeric project IDs being interpreted as integers by YAML parsers.

GCP project identifiers may appear numeric but must always be handled as string identifiers to maintain their integrity and prevent parsing errors. The YAML !!str type tag forces the parser to treat these values as strings regardless of their appearance, eliminating any ambiguity during configuration processing.

I considered using the escape_string Handlebar helper function but went with !!str because it's a pure YAML solution to the problem.

[git-generate]
perl -i -p -e 's/^project_id: \{\{project_id\}\}/project_id: !!str {{project_id}}/g' packages/gcp*/**/*.yml.hbs

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

This change adds explicit YAML string type casting using the `!!str` tag
to the project_id field across all GCP data stream template files. The
modification ensures that project identifiers are parsed as string
values in the generated YAML configuration, preventing potential issues
that could arise from numeric project IDs being interpreted as integers
by YAML parsers.

GCP project identifiers may appear numeric but must always be handled as
string identifiers to maintain their integrity and prevent parsing
errors. The YAML `!!str` type tag forces the parser to treat these
values as strings regardless of their appearance, eliminating any
ambiguity during configuration processing.

I considered using the escape_string Handlebar helper function but went
with !!str because it's a pure YAML solution to the problem.

[git-generate]
perl -i -p -e 's/^project_id: \{\{project_id\}\}/project_id: !!str {{project_id}}/g' packages/gcp*/**/*.yml.hbs
[git-generate]
for i in packages/gcp*; do elastic-package -C $i changelog add --description 'Fixed GCP project ID handling to prevent numeric parsing issues by enforcing string type casting in YAML configuration templates.' --next patch --type bugfix --link elastic#14765; done
@andrewkroh
andrewkroh marked this pull request as ready for review July 31, 2025 14:21
@andrewkroh
andrewkroh requested review from a team as code owners July 31, 2025 14:21
@andrewkroh andrewkroh added Integration:gcp Google Cloud Platform Integration:gcp_pubsub Custom Google Pub/Sub Logs Integration:gcp_metrics GCP Metrics Input Integration:gcp_vertexai GCP Vertex AI Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Team:obs-ds-hosted-services Observability Hosted Services team [elastic/obs-ds-hosted-services] Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations] labels Jul 31, 2025
@elasticmachine

Copy link
Copy Markdown

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@andrewkroh andrewkroh added the bugfix Pull request that fixes a bug issue label Jul 31, 2025
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

@andrewkroh
andrewkroh merged commit 2ee6ef3 into elastic:main Aug 15, 2025
9 checks passed
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package gcp - 2.42.2 containing this change is available at https://epr.elastic.co/package/gcp/2.42.2/

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package gcp_metrics - 0.3.1 containing this change is available at https://epr.elastic.co/package/gcp_metrics/0.3.1/

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package gcp_pubsub - 2.2.1 containing this change is available at https://epr.elastic.co/package/gcp_pubsub/2.2.1/

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package gcp_vertexai - 1.3.1 containing this change is available at https://epr.elastic.co/package/gcp_vertexai/1.3.1/

tehbooom pushed a commit to tehbooom/integrations that referenced this pull request Nov 19, 2025
…tic#14765)

This change adds explicit YAML string type casting using the `!!str` tag
to the project_id field across all GCP data stream template files. The
modification ensures that project identifiers are parsed as string
values in the generated YAML configuration, preventing potential issues
that could arise from numeric project IDs being interpreted as integers
by YAML parsers.

GCP project identifiers may appear numeric but must always be handled as
string identifiers to maintain their integrity and prevent parsing
errors. The YAML `!!str` type tag forces the parser to treat these
values as strings regardless of their appearance, eliminating any
ambiguity during configuration processing.

I considered using the escape_string Handlebar helper function but went
with !!str because it's a pure YAML solution to the problem.

[git-generate]
perl -i -p -e 's/^project_id: \{\{project_id\}\}/project_id: !!str {{project_id}}/g' packages/gcp*/**/*.yml.hbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a bug issue Integration:gcp_metrics GCP Metrics Input Integration:gcp_pubsub Custom Google Pub/Sub Logs Integration:gcp_vertexai GCP Vertex AI Integration:gcp Google Cloud Platform Team:obs-ds-hosted-services Observability Hosted Services team [elastic/obs-ds-hosted-services] Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations] Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

5 participants