Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .windsurf/plans/WSRE-607.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Plan: Implement ACME Challenge LB Rules for Bestnet

We will add OpenStack Load Balancer resources to `nomadclient.tf` to handle ACME challenges, creating a dedicated pool and L7 rules to redirect `.well-known/acme-challenge/` traffic. A new variable will be introduced to handle the port difference between environments (8081 default, 8080 for prod-bestnet).

## Proposed Changes

### 1. Modify `nomadclient.tf`
- Add `variable "nomadclient_acme_port"` with a default value of `8081`.
- Add the following resources (adapted from the ticket snippet):
- `openstack_lb_pool_v2.nomadclient_challenge_acme`
- `openstack_lb_member_v2.nomadclient_challenge_acme` (using `var.nomadclient_acme_port`)
- `openstack_lb_monitor_v2.acme_healthmonitor`
- `openstack_lb_l7policy_v2.acme_challenge_policy`
- `openstack_lb_l7rule_v2.acme_challenge_rule`

### 2. Modify `environments/prod-bestnet.tfvars`
- Add `nomadclient_acme_port = 8080` to override the default for the production environment, aligning with the ticket's note.

## Rationale
- The ticket explicitly provides the Terraform configuration needed to support the new Vault-based Let's Encrypt integration.
- The comment "in prod_bestnet protocol_port = 8080" indicates a deviation from the snippet's 8081 for the production environment. Using a variable allows us to apply the standard configuration while respecting the environment-specific requirement.
- Existing `nomadclient` resources in `nomadclient.tf` confirm the resource names match the snippet (e.g., `openstack_compute_instance_v2.nomadclient`).

## Verification
- Verify that `nomadclient.tf` successfully validates.
- Ensure `prod-bestnet.tfvars` correctly overrides the port.
Comment on lines +1 to +26
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file appears to be unrelated to the PR's stated purpose of creating Terragrunt example configurations. It describes implementing ACME Challenge LB Rules for Bestnet with OpenStack resources, which is a different feature entirely. This file may have been included accidentally and should likely be removed from this PR or committed separately.

Suggested change
# Plan: Implement ACME Challenge LB Rules for Bestnet
We will add OpenStack Load Balancer resources to `nomadclient.tf` to handle ACME challenges, creating a dedicated pool and L7 rules to redirect `.well-known/acme-challenge/` traffic. A new variable will be introduced to handle the port difference between environments (8081 default, 8080 for prod-bestnet).
## Proposed Changes
### 1. Modify `nomadclient.tf`
- Add `variable "nomadclient_acme_port"` with a default value of `8081`.
- Add the following resources (adapted from the ticket snippet):
- `openstack_lb_pool_v2.nomadclient_challenge_acme`
- `openstack_lb_member_v2.nomadclient_challenge_acme` (using `var.nomadclient_acme_port`)
- `openstack_lb_monitor_v2.acme_healthmonitor`
- `openstack_lb_l7policy_v2.acme_challenge_policy`
- `openstack_lb_l7rule_v2.acme_challenge_rule`
### 2. Modify `environments/prod-bestnet.tfvars`
- Add `nomadclient_acme_port = 8080` to override the default for the production environment, aligning with the ticket's note.
## Rationale
- The ticket explicitly provides the Terraform configuration needed to support the new Vault-based Let's Encrypt integration.
- The comment "in prod_bestnet protocol_port = 8080" indicates a deviation from the snippet's 8081 for the production environment. Using a variable allows us to apply the standard configuration while respecting the environment-specific requirement.
- Existing `nomadclient` resources in `nomadclient.tf` confirm the resource names match the snippet (e.g., `openstack_compute_instance_v2.nomadclient`).
## Verification
- Verify that `nomadclient.tf` successfully validates.
- Ensure `prod-bestnet.tfvars` correctly overrides the port.
# Plan: Create Terragrunt Example Configurations
We will add and organize Terragrunt example configurations to illustrate how to consume the existing Terraform modules in a consistent, reusable way. Examples will live under a dedicated `examples/` hierarchy, with clear documentation of required inputs, outputs, and common usage patterns.
## Proposed Changes
### 1. Add base Terragrunt example structure
- Create an `examples/` directory (if it does not already exist).
- Under `examples/`, add one or more subdirectories (for example, `examples/simple-environment/`, `examples/production-like/`) to hold self-contained Terragrunt configurations.
- In each example directory, add a `terragrunt.hcl` that:
- References the appropriate Terraform module using `terraform { source = ... }`.
- Defines `inputs` for all required module variables, using simple, realistic example values.
- Optionally demonstrates use of Terragrunt features such as `include`, `locals`, and `dependency` where helpful but without adding unnecessary complexity.
### 2. Document how to use the examples
- Add a short `README.md` in the `examples/` directory that:
- Lists the available example configurations and their purpose.
- Shows how to run an example end-to-end with `terragrunt init` and `terragrunt apply`.
- Notes any assumptions (e.g., required environment variables, backend configuration, or credentials) needed to run the examples.
### 3. Keep examples read-only and non-destructive by default
- Ensure example configurations are safe to run in a typical developer environment:
- Use minimal, low-cost resources where possible.
- Clearly mark any examples that may create billable or irreversible infrastructure.
- Where appropriate, configure examples so they can be destroyed cleanly with `terragrunt destroy`.
## Rationale
- The purpose of this work is to provide Terragrunt example configurations, so the plan must focus on adding and documenting those examples rather than unrelated infrastructure changes.
- Centralizing examples under `examples/` makes it easier for users to discover, run, and learn from them without impacting production configurations.
- Well-documented examples reduce onboarding time and help ensure modules are used consistently across environments.
## Verification
- From each example directory, run `terragrunt init` to verify the configuration initializes successfully.
- Run `terragrunt plan` to confirm that the examples reference the correct Terraform modules and that all required inputs are provided.
- Optionally run `terragrunt apply` in a non-production account or environment to confirm the examples work as documented and can be destroyed cleanly with `terragrunt destroy`.

Copilot uses AI. Check for mistakes.
18 changes: 18 additions & 0 deletions tests/terragrunt/bar/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/terragrunt/bar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Terragrunt Example

This directory contains a simple Terragrunt configuration that creates a local file.

## Usage

After creating "terragrunt.hcl", run the following commands:
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The terragrunt.hcl file is empty, but the README.md documentation refers to creating this file. According to the Terragrunt Quick Start guide, this file should contain configuration such as terraform block with source path or other Terragrunt-specific settings. An empty file defeats the purpose of a Terragrunt example configuration.

Copilot uses AI. Check for mistakes.

```fish
terragrunt plan --log-format bare
terragrunt apply
```

For variable input, run the following:

```fish
terragrunt apply -auto-approve -var content='Hello, Terragrunt!'
```
1 change: 1 addition & 0 deletions tests/terragrunt/bar/hi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, Terragrunt!
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hi.txt file appears to be generated output from running the Terraform configuration (created by the local_file resource in main.tf). Generated files should typically be excluded from version control using .gitignore rather than committed to the repository.

Copilot uses AI. Check for mistakes.
6 changes: 6 additions & 0 deletions tests/terragrunt/bar/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
variable "content" {}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable "content" is declared without a type constraint, default value, or description. This makes the variable difficult to use and understand. Consider adding type = string, a description explaining its purpose, and potentially a default value or validation rules.

Suggested change
variable "content" {}
variable "content" {
type = string
description = "Content to write to the hi.txt local file."
}

Copilot uses AI. Check for mistakes.

resource "local_file" "file" {
content = var.content
filename = "${path.module}/hi.txt"
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire contents of the foo and bar directories are identical, creating significant code duplication. This violates the DRY (Don't Repeat Yourself) principle. Consider using a single shared Terraform module or consolidating these into one example directory, or differentiate them if they are meant to serve different purposes.

Suggested change
filename = "${path.module}/hi.txt"
filename = "${path.module}/hi-bar.txt"

Copilot uses AI. Check for mistakes.
}
Empty file.
18 changes: 18 additions & 0 deletions tests/terragrunt/foo/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/terragrunt/foo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Terragrunt Example

This directory contains a simple Terragrunt configuration that creates a local file.

## Usage

After creating "terragrunt.hcl", run the following commands:
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The terragrunt.hcl file is empty, but the README.md documentation refers to creating this file. According to the Terragrunt Quick Start guide, this file should contain configuration such as terraform block with source path or other Terragrunt-specific settings. An empty file defeats the purpose of a Terragrunt example configuration.

Copilot uses AI. Check for mistakes.

```fish
terragrunt plan --log-format bare
terragrunt apply
```

For variable input, run the following:

```fish
terragrunt apply -auto-approve -var content='Hello, Terragrunt!'
```
1 change: 1 addition & 0 deletions tests/terragrunt/foo/hi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, Terragrunt!
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hi.txt file appears to be generated output from running the Terraform configuration (created by the local_file resource in main.tf). Generated files should typically be excluded from version control using .gitignore rather than committed to the repository.

Copilot uses AI. Check for mistakes.
6 changes: 6 additions & 0 deletions tests/terragrunt/foo/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
variable "content" {}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable "content" is declared without a type constraint, default value, or description. This makes the variable difficult to use and understand. Consider adding type = string, a description explaining its purpose, and potentially a default value or validation rules.

Suggested change
variable "content" {}
variable "content" {
type = string
description = "Content to write into the hi.txt local file."
}

Copilot uses AI. Check for mistakes.

resource "local_file" "file" {
content = var.content
filename = "${path.module}/hi.txt"
}
Empty file.