Skip to content

Comments

Add variable to determine sidecar container position in container list#47

Draft
Kashuab wants to merge 3 commits intoDataDog:mainfrom
Kashuab:sidecar-position
Draft

Add variable to determine sidecar container position in container list#47
Kashuab wants to merge 3 commits intoDataDog:mainfrom
Kashuab:sidecar-position

Conversation

@Kashuab
Copy link
Contributor

@Kashuab Kashuab commented Dec 2, 2025

What does this PR do?

Adds a variable that allows users to determine if the container is prepended or appended. Appending the sidecar container instead of prepending helps for migration cases.

Motivation

Upon trying to deploy with this module, terraform apply was failing with the following error:

[
  {
    "@type": "type.googleapis.com/google.rpc.BadRequest",
    "fieldViolations": [
      {
        "description": "Revision template should contain exactly one container with an exposed port.",
        "field": "template.containers"
      }
    ]
  }
]

My hypothesis is that since the default behavior is to prepend the sidecar container into the service, Google was trying to update the existing main service container to be the sidecar (retaining the ports for some reason) while simultaneously creating a new app container to serve traffic.

Using an append strategy solved the error in our case, because it instead only creates a new container without ports by default.

Describe how you validated your changes

Ran terraform apply using the latest commit on the fork, and datadog_sidecar_position = "append" on both modules definitions and the issue was resolved.

Additional Notes

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.

1 participant