type: user

role: user

content:
You are implementing Task B2 of the "DD Agent Logs via Vector" plan.

## Task Description

Add a new `logs_intake_url` variable to the DD Agent module's variables.tf with URL-prefix validation.

**File to modify:** `/Users/steve.briggs/projects/IAC/terraform/internal-modules/kubernetes/monitoring/datadog-agent/variables.tf`

Append to the end of the file (after the existing `variable "enable_mrds_monitoring"` block, around line 122):

```hcl

variable "logs_intake_url" {
  description = "OPW-compatible logs intake URL. When set, the agent ships logs to this endpoint via DD_OBSERVABILITY_PIPELINES_WORKER_LOGS_URL. For cluster-internal Vector use module.vector.service_endpoint_dd_agent. When null (default), logs ship direct to Datadog SaaS."
  type        = string
  default     = null

  validation {
    condition     = var.logs_intake_url == null || can(regex("^https?://", var.logs_intake_url))
    error_message = "logs_intake_url must be a URL starting with http:// or https://, or null."
  }
}
```

(Leading blank line so it's separated from the previous variable.)

## Verification

```
cd /Users/steve.briggs/projects/IAC/terraform/internal-modules/kubernetes/monitoring/datadog-agent
terraform fmt variables.tf
```

Expected: no output (or it auto-formats and exits 0).

## CRITICAL — No git operations

Do NOT run any git commands. Sir Charles handles git himself.

## Your Job

1. Read variables.tf to confirm the current end-of-file shape.
2. Append the new variable block.
3. Run `terraform fmt variables.tf`.
4. Self-review.
5. Report back.

## Report Format

- **Status:** DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
- File modified
- terraform fmt output
- The exact added block as it appears in the file
- Any concerns

userType: external

entrypoint: cli

gitBranch: master


type: message

role: assistant

type: text

text:
I'll implement Task B2 by adding the `logs_intake_url` variable to the DD Agent module's variables.tf file.

Let me start by reading the current state of the file.

service_tier: standard

attributionAgent: general-purpose

attributionPlugin: superpowers

type: assistant


Read

type: direct

speed: standard


content:
1	variable "name" {
2	  description = "The name of the Helm release."
3	  type        = string
4	  default     = "immuta-dd"
5	}
6
7	variable "namespace" {
8	  description = "The Kubernetes namespace to deploy the Datadog agent into."
9	  type        = string
10	  default     = "datadog"
11	}
12
13	variable "create_namespace" {
14	  description = "Whether to create the namespace. Set to false if the namespace already exists."
15	  type        = bool
16	  default     = true
17	}
18
19	variable "chart_version" {
20	  description = "The version of the Datadog Helm chart to use."
21	  type        = string
22	}
23
24	variable "env" {
25	    description = "The environment that resources are deployed to. i.e. nonprod, prod"
26	    type        = string
27	}
28
29	variable "global_segment" {
30	  description = "The global segment to use for tagging and other purposes."
31	  type        = string
32	}
33
34	variable "image_tag" {
35	    description = "The tag of the Datadog agent image to use."
36	    type        = string
37	}
38
39	variable "cluster_name" {
40	  description = "The name of the Kubernetes cluster, to be used for tagging."
41	  type        = string
42	}
43
44	variable "datadog_tags" {
45	    description = "A map of global tags to apply to all metrics, traces, and logs."
46	    type        = list(string)
47	    default     = []
48	}
49
50	variable "enable_now_obfusicator_options" {
51	    description = "Whether to enable the NOWRDS obfuscator options in the Datadog agent configuration."
52	    type        = bool
53	    default     = false
54	}
55
56	variable "now_obfusicator_options" {
57	    description = "A map of options to configure the NOWRDS obfuscator in the Datadog agent configuration."
58	    type        = map(string)
59	    default     = {
60	      replace_digits = "true"
61	    }
62	}
63
64	variable "datadog_api_key_secret_name" {
65	  description = "The name of the Kubernetes secret holding the Datadog API key."
66	  type        = string
67	  default     = "datadog-api-key"
68	}
69
70	variable "cluster_agent_token_secret_name" {
71	  description = "The name of the Kubernetes secret for the cluster agent token."
72	  type        = string
73	  default     = "datadog-clusteragent-token"
74	}
75
76	variable "log_level" {
77	    description = "The log level for the Datadog agent."
78	    type        = string
79	    default     = "ERROR"
80	}
81
82	variable "apm_enabled" {
83	    description = "Whether to enable APM for the Datadog agent."
84	    type        = bool
85	    default     = true
86	}
87
88	variable "container_exclude" {
89	    description = "A list of container names to exclude from monitoring."
90	    type        = string
91	    default     = "kube_namespace:datadog name:enterprise"
92	}
93
94	variable "container_exclude_logs" {
95	    description = "A list of container names to exclude from log collection."
96	    type        = string
97	    default     = "image:registry.k8s.io/autoscaling/cluster-autoscaler image:registry.ic-ops.net/cache-k8s-registry/autoscaling/cluster-autoscaler"
98	}
99
100	variable "tags" {
101	  description = "A list of global tags to apply to all metrics, traces, and logs."
102	  type        = map(any)
103	  default     = {}
104	}
105
106	variable "agents_priority_class_name" {
107	  description = "The priority class name for the Datadog agents."
108	  type        = string
109	  default     = "cloud-ops-system"
110	}
111
112	variable "enable_nowrds_monitoring" {
113	  description = "Enable monitoring for NOWRDS."
114	  type        = bool
115	  default     = false
116	}
117
118	variable "enable_mrds_monitoring" {
119	  description = "Enable monitoring for MRDS."
120	  type        = bool
121	  default     = false
122	}
123


text: Good! The file ends at line 122 with the `enable_mrds_monitoring` variable block. Now I'll append the new `logs_intake_url` variable block:


Edit

old_string:
variable "enable_mrds_monitoring" {
  description = "Enable monitoring for MRDS."
  type        = bool
  default     = false
}

new_string:
variable "enable_mrds_monitoring" {
  description = "Enable monitoring for MRDS."
  type        = bool
  default     = false
}

variable "logs_intake_url" {
  description = "OPW-compatible logs intake URL. When set, the agent ships logs to this endpoint via DD_OBSERVABILITY_PIPELINES_WORKER_LOGS_URL. For cluster-internal Vector use module.vector.service_endpoint_dd_agent. When null (default), logs ship direct to Datadog SaaS."
  type        = string
  default     = null

  validation {
    condition     = var.logs_intake_url == null || can(regex("^https?://", var.logs_intake_url))
    error_message = "logs_intake_url must be a URL starting with http:// or https://, or null."
  }
}


content: The file /Users/steve.briggs/projects/IAC/terraform/internal-modules/kubernetes/monitoring/datadog-agent/variables.tf has been updated successfully. (file state is current in your context — no need to Read it back)


text: Now let me run `terraform fmt` to verify formatting:


Bash

command: cd /Users/steve.briggs/projects/IAC/terraform/internal-modules/kubernetes/monitoring/datadog-agent && terraform fmt variables.tf


content:
variables.tf
[This command modified 1 file you've previously read: ../../../../internal-modules/kubernetes/monitoring/datadog-agent/variables.tf. Call Read before editing.]


text: Good! The file was modified by `terraform fmt`. Let me read the end of the file to verify the new variable block was formatted correctly:


content:
110	}
111
112	variable "enable_nowrds_monitoring" {
113	  description = "Enable monitoring for NOWRDS."
114	  type        = bool
115	  default     = false
116	}
117
118	variable "enable_mrds_monitoring" {
119	  description = "Enable monitoring for MRDS."
120	  type        = bool
121	  default     = false
122	}
123
124	variable "logs_intake_url" {
125	  description = "OPW-compatible logs intake URL. When set, the agent ships logs to this endpoint via DD_OBSERVABILITY_PIPELINES_WORKER_LOGS_URL. For cluster-internal Vector use module.vector.service_endpoint_dd_agent. When null (default), logs ship direct to Datadog SaaS."
126	  type        = string
127	  default     = null
128
129	  validation {
130	    condition     = var.logs_intake_url == null || can(regex("^https?://", var.logs_intake_url))
131	    error_message = "logs_intake_url must be a URL starting with http:// or https://, or null."
132	  }
133	}
134


text: Perfect! Let me run terraform fmt one more time to confirm it's stable (no further changes):


command: cd /Users/steve.briggs/projects/IAC/terraform/internal-modules/kubernetes/monitoring/datadog-agent && terraform fmt variables.tf && echo "Exit code: $?"


content: Exit code: 0


text:
Excellent! No output on the second run means the formatting is stable.

## Status: DONE

**File modified:** `/Users/steve.briggs/projects/IAC/terraform/internal-modules/kubernetes/monitoring/datadog-agent/variables.tf`

**terraform fmt output:** Exit code 0 (no changes on second run, confirming stable formatting)

**The added block (lines 124-133):**
```hcl
variable "logs_intake_url" {
  description = "OPW-compatible logs intake URL. When set, the agent ships logs to this endpoint via DD_OBSERVABILITY_PIPELINES_WORKER_LOGS_URL. For cluster-internal Vector use module.vector.service_endpoint_dd_agent. When null (default), logs ship direct to Datadog SaaS."
  type        = string
  default     = null

  validation {
    condition     = var.logs_intake_url == null || can(regex("^https?://", var.logs_intake_url))
    error_message = "logs_intake_url must be a URL starting with http:// or https://, or null."
  }
}
```

**Concerns:** None. The variable has been appended correctly with proper separation from the previous block, formatting is stable, and the validation logic correctly allows null or URLs with http/https protocols.