Skip to content

breaking(terraform-agent): update files for agent host deployment#929

Open
rene-oromtz wants to merge 16 commits intomainfrom
feat/update-terraform
Open

breaking(terraform-agent): update files for agent host deployment#929
rene-oromtz wants to merge 16 commits intomainfrom
feat/update-terraform

Conversation

@rene-oromtz
Copy link
Contributor

@rene-oromtz rene-oromtz commented Feb 19, 2026

Description

This PR updates the terraform files for agent host to be able to work with authentication.
It also aligns with the standards defined in CC008 specification.

Changes introduced:

  • README.md: updated to be aligned with the requirements in Spec including variables, inputs and outputs.
  • main.tf: modify file to include required variables, including modifying model_uuid instead of model name.
  • providers.tf: Empty file just for matching spec requirements
  • terraform.tf: renamed versions.tf to terraform.tf as required by spec. It also includes the use of "any" Terraform provider in 1.x version as all charm modules should be above 1.0.0 version.
  • output.tf: included application and provides from charm application.
  • variables.tf: This includes all the required variables in alphabetical order
  • locals.tf: removed as it only included what it should now be covered by the constraints variable.
  • CONTRIBUTING.md: this includes the information that was in the README.md regarding testing locally agent hosts deployment via Terraform. Also adds information about Pull Request requirements for semantic versioning.
  • terraform/dev directory added as well for simpliying local testing.

Note

config map(string) should take care of all charm configuration, in order to keep base64 encoded as sensitive, handling them as separate variables that are then merged to the config var

This also adds a semantic version to follow the proposed lifecycle where the modification should be tagged with:
<product>-X-Y-Z.

Semantic test: https://github.com/canonical/testflinger/actions/runs/22318803845/job/64571130324?pr=929

Create tag
Notice: testflinger-agent-host-1.0.0

Resolved issues

Resolves CERTTF-837

Documentation

Public documentation already references Terraform README file:
https://canonical-testflinger.readthedocs-hosted.com/latest/how-to/administer-agent-hosts/deploy-testflinger-agent-host/#terraform

Web service API changes

Tests

Tested on a multipass environment. Tagged commit b96e3b6 with version testflinger-agent-host-0.1.0 as this was the last modification to the terraform files.

I then tested deploying with version 0.1.0 and upgrading to this branch version. While breaking changes on provider side (model_uuid instead of model name), the application is NOT recreated, its updated in place as expected.

Full testing:
https://pastebin.canonical.com/p/HwbG4757TM/

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.85%. Comparing base (9cbb26f) to head (21d5afe).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #929   +/-   ##
=======================================
  Coverage   73.85%   73.85%           
=======================================
  Files         108      108           
  Lines       10313    10313           
  Branches      886      886           
=======================================
  Hits         7617     7617           
  Misses       2508     2508           
  Partials      188      188           
Flag Coverage Δ *Carryforward flag
agent 74.40% <ø> (ø)
cli 89.56% <ø> (ø) Carriedforward from 7084391
device 59.86% <ø> (ø) Carriedforward from 7084391
server 87.85% <ø> (ø) Carriedforward from 7084391

*This pull request uses carry forward flags. Click here to find out more.

Components Coverage Δ
Agent 74.40% <ø> (ø)
CLI 89.56% <ø> (ø)
Common ∅ <ø> (∅)
Device Connectors 59.86% <ø> (ø)
Server 87.85% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rene-oromtz rene-oromtz changed the title terraform: update files for agent host deployment breaking(terraform-agent): update files for agent host deployment Feb 23, 2026
@rene-oromtz rene-oromtz force-pushed the feat/update-terraform branch from 6003d08 to 52cfe91 Compare February 23, 2026 18:12
output "provides" {
description = "Map of provided integration endpoints"
value = {
cos-agent = "cos-agent"
Copy link
Collaborator

@pedro-avalos pedro-avalos Feb 27, 2026

Choose a reason for hiding this comment

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

I think the intent of this spec was to provide a more terraform-native way of getting these, since terraform I think frowns upon dashes

Suggested change
cos-agent = "cos-agent"
cos_agent = "cos-agent"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah you are right: https://developer.hashicorp.com/terraform/language/style#resource-naming
Seems it supports both but guess they preferred the underscores

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Terraform didn't like it :(

# module.agent-host.juju_application.testflinger-agent-host will be destroyed
  # (because juju_application.testflinger-agent-host is not in configuration)
  - resource "juju_application" "testflinger-agent-host" {
 ...

This forced a recreation with the new application name:

# module.agent-host.juju_application.testflinger_agent_host will be created
  + resource "juju_application" "testflinger_agent_host" {
...
Plan: 3 to add, 0 to change, 1 to destroy.

Guess that we will need to keep the dashes for backwards compatibility...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(This is just applicable for the juju_application resource... For all new resources I ended up using snake_case)

@rene-oromtz rene-oromtz marked this pull request as ready for review March 3, 2026 00:03
@rene-oromtz
Copy link
Contributor Author

Hi @nancyc12 @diohe0311 if any of you have time, can anyone please help me to take a look at this PR? Want to get your feedback as this impacts TEL deployments so just want to make sure I'm not missing anything.

I tested upgrading between the terraform module testflinger-agent-host-0.1.0 to this proposed version and changes should be non disruptive.

@diohe0311
Copy link
Contributor

Hi @nancyc12 @diohe0311 if any of you have time, can anyone please help me to take a look at this PR? Want to get your feedback as this impacts TEL deployments so just want to make sure I'm not missing anything.

I tested upgrading between the terraform module testflinger-agent-host-0.1.0 to this proposed version and changes should be non disruptive.

Hey, I found that tel-labs/agent-host-tel-ln is affected by this change, and its versions.tf pins juju to ~> 0.17.0. If this module bumps the required provider to ~> 1.0, Terraform provider resolution might fail due to incompatible constraints. Are we planning to upgrade the TEL environments to juju provider 1.x as part of this change, or should we coordinate that first?

@rene-oromtz
Copy link
Contributor Author

Hey Dio! Yes, I opened this PR to update all Terraform modules to 1.0 version.
Those are pointing to this Terraform module 1.0.0 version (which is the next tag for this module once merged)

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.

3 participants