dev_center_dev_box_definition implementation#15
Conversation
Bumps the actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [terraform-linters/setup-tflint](https://github.com/terraform-linters/setup-tflint) and [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform). Updates `actions/checkout` from 3 to 4 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) Updates `terraform-linters/setup-tflint` from 3 to 4 - [Release notes](https://github.com/terraform-linters/setup-tflint/releases) - [Commits](terraform-linters/setup-tflint@v3...v4) Updates `hashicorp/setup-terraform` from 2 to 3 - [Release notes](https://github.com/hashicorp/setup-terraform/releases) - [Changelog](https://github.com/hashicorp/setup-terraform/blob/main/CHANGELOG.md) - [Commits](hashicorp/setup-terraform@v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: terraform-linters/setup-tflint dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: hashicorp/setup-terraform dependency-version: '3' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Arnaud Lheureux <arnaudlh@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Terraform module for creating Azure Dev Center Dev Box Definitions, updates documentation and examples to reflect the new image_reference_id pattern, and introduces unit tests to validate module outputs.
- Introduce
modules/dev_center_dev_box_definitionwith variable, resource, and output definitions - Add HCL-based unit tests under
tests/unit/dev_center_dev_box_definition - Update examples and module guide to use
image_reference_idinstead of the old image blocks
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/dev_center_dev_box_definition/dev_box_definition_test.tftest.hcl | New unit tests for module outputs |
| modules/dev_center_dev_box_definition/variables.tf | Define inputs for dev box definition including name, image, sku |
| modules/dev_center_dev_box_definition/module.tf | Create azurecaf_name and azurerm_dev_center_dev_box_definition |
| modules/dev_center_dev_box_definition/output.tf | Output the Dev Box Definition's ID |
| examples/dev_center_dev_box_definition/configuration.tfvars | Example configuration for the new module |
| examples/dev_center/simple_case/configuration.tfvars | Extended simple-case example with dev box definition |
| docs/module_guide.md | Replace old image block with image_reference_id |
| dev_center_dev_box_definitions.tf | Instantiate the new module in the root configuration |
Comments suppressed due to low confidence (4)
docs/module_guide.md:132
- The documentation shows a
hibernate_supportblock, but the module does not accept or forward this setting. Either implement an input forhibernate_supportinvariables.tfand pass it through, or remove this example from the guide.
hibernate_support = {
tests/unit/dev_center_dev_box_definition/dev_box_definition_test.tftest.hcl:41
- In the test variables block,
var.dev_box_definitionis undefined. Replace this with a direct string value forimage_reference_idor reference the correct variable path undervar.dev_center_dev_box_definitions.
image_reference_id = try(var.dev_box_definition.image_reference_id, null)
tests/unit/dev_center_dev_box_definition/dev_box_definition_test.tftest.hcl:42
- Similar to the previous assertion,
var.dev_box_definitiondoes not exist in this context. Use the defineddev_center_dev_box_definitions.definition1.sku_namevalue directly.
sku_name = try(var.dev_box_definition.sku_name, null)
modules/dev_center_dev_box_definition/output.tf:1
- The module does not currently output the resource
name, causing tests that assert onmodule.dev_center_dev_box_definitions["definition1"].nameto fail. Add an output forname(e.g.,value = azurecaf_name.dev_box_definition.result).
output "id" {
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Terraform module for Azure Dev Center Dev Box Definitions, complete with input variables, resource implementation, outputs, unit tests, examples, and documentation updates.
- Introduces
dev_center_dev_box_definitionmodule (variables, implementation, output) - Adds unit tests and example configuration for the new module
- Updates documentation and root module instantiation to wire up the new module
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/dev_center_dev_box_definition/variables.tf | Defines the input schema for Dev Box Definition |
| modules/dev_center_dev_box_definition/module.tf | Implements the azurerm_dev_center_dev_box_definition resource |
| modules/dev_center_dev_box_definition/output.tf | Exposes the Dev Box Definition ID as module output |
| tests/unit/dev_center_dev_box_definition/dev_box_definition_test.tftest.hcl | Adds unit tests to validate name, ID, and tags outputs |
| examples/dev_center_dev_box_definition/configuration.tfvars | Provides a sample variable file illustrating how to configure the module |
| docs/module_guide.md | Updates the module guide example to reflect the new image_reference_id input |
| dev_center_dev_box_definitions.tf | Instantiates the new module in the root Terraform configuration |
| .github/copilot-instructions.md | Minor cleanup in Copilot instructions (nonfunctional) |
Comments suppressed due to low confidence (3)
docs/module_guide.md:132
- The example includes 'hibernate_support', but this parameter is not defined in the module's variables. Either remove it from the example or add support in the module.
hibernate_support = {
tests/unit/dev_center_dev_box_definition/dev_box_definition_test.tftest.hcl:69
- [nitpick] Consider adding assertions to verify that 'image_reference_id' and 'sku_name' are correctly passed through and available in the module outputs.
assert {
tests/unit/dev_center_dev_box_definition/dev_box_definition_test.tftest.hcl:41
- In the test variables block, 'var.dev_box_definition' is not defined in this scope. You should reference the literal value set above (e.g. the string provided to dev_center_dev_box_definitions.definition1.image_reference_id) or define a matching variable.
image_reference_id = try(var.dev_box_definition.image_reference_id, null)
| for_each = try(var.dev_center_dev_box_definitions, {}) | ||
|
|
||
| global_settings = var.global_settings | ||
| dev_box_definition = each.value |
There was a problem hiding this comment.
The module variable 'dev_box_definition' expects an object with only name, image_reference_id, sku_name, and optional tags, but 'each.value' also contains 'dev_center' and 'resource_group' keys. Either adjust the module signature to accept those keys or pass a filtered object matching the expected schema.
| dev_box_definition = each.value | |
| dev_box_definition = { | |
| name = each.value.name | |
| image_reference_id = each.value.image_reference_id | |
| sku_name = each.value.sku_name | |
| tags = lookup(each.value, "tags", null) | |
| } |
| @@ -0,0 +1,35 @@ | |||
| variable "global_settings" { | |||
| description = "Global settings object" | |||
| type = object({ | |||
There was a problem hiding this comment.
The 'global_settings' variable here omits fields like 'environment' and 'regions' required by the project's standard global_settings object. Update its type to match the shared global_settings definition for consistency.
This pull request introduces a new Terraform module for managing Azure Dev Center Dev Box Definitions, along with updates to documentation, examples, and unit tests. The changes focus on enabling the creation and configuration of Dev Box Definitions with customizable settings and improved modularity.
Important
The current implementation assumes usage of the image gallery included in the dev center by default.
An update to this module is required when
azurerm_dev_center_galleryis implemented.Sample Terraform Output