Skip to content

tofu-infra: refactor into the project module layout

FNegri requested to merge project-module into main

Refactor the tofu-infra repository into the project module layout.

This has major implications in how both the code is in the repository and how resources live in the opentofu state.

In particular, the code in the repository is decoupled in the following way:

  • a project module, which contains the 'logic' to create a project and all possible resources for it
  • a resources module, which contains the 'settings' for each deployment, and each project within the deployment
  • the root module reconciles the two, loading the resources and injecting them into the project module

The tofu state has this project as top level element in the state hierarchy, something like this:

  • module.project["some-project"].openstack_some_api.some_resource["some-resource-id"]

One of the consequences of this, is that tracking and removing projects and resources is now a more "atomic" operation. For example, removing a project from the list of projects will automatically remove all resources that belong to that project. This is something the openstack API doesn't do nativelly.

Bug: T375283

Edited by Arturo Borrero Gonzalez

Merge request reports

Loading