Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project factory additions, project module reuse implementation #2899

Merged
merged 11 commits into from
Feb 15, 2025

Conversation

ludoo
Copy link
Collaborator

@ludoo ludoo commented Feb 15, 2025

This PR extends the project factory to support additional use cases, and expands its internal context interpolation:

  • GCS buckets are added as a project-level primitive (automation buckets are ofc still available)
  • interpolation between project and automation level resources, and with the new bucket resource has been extended to cover all possible use cases

This is the supported interpolations, the table has been added to the module docs:

image

The changes in the project factory require splitting its project handling in two separate module calls to avoid cycles, which surfaced the old issue with data sources in tests. This PR also addresses that, by changing the project module interface so that when a project is reused, the data source can be disabled if the project name and number are known. This is an example from one the updated project module examples:

module "create-project" {
  source          = "./fabric/modules/project"
  billing_account = var.billing_account_id
  name            = "project"
  parent          = var.folder_id
  prefix          = var.prefix
}

module "project" {
  source          = "./fabric/modules/project"
  name            = module.create-project.project_id
  prefix          = var.prefix
  # default behavior, uses a data source internally
  # project_reuse = {}
  # avoid use of a data source when project attributes are available
  project_reuse = {
    use_data_source = false
    project_attributes = {
      name   = module.create-project.name
      number = module.create-project.number
    }
  }

A small change to the tfdoc tool is also part of this PR, to allow optionally skipping specific headings in the generated table of contents.

@ludoo ludoo marked this pull request as ready for review February 15, 2025 14:00
@ludoo ludoo enabled auto-merge (squash) February 15, 2025 14:09
Copy link
Collaborator

@wiktorn wiktorn left a comment

Choose a reason for hiding this comment

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

❤️

Co-authored-by: Wiktor Niesiobędzki <[email protected]>
@ludoo ludoo merged commit 1a4b298 into fast-dev Feb 15, 2025
18 checks passed
@ludoo ludoo deleted the ludo/pf-automation-self branch February 15, 2025 19:37
karpok78 pushed a commit to karpok78/cloud-foundation-fabric that referenced this pull request Feb 16, 2025
…eCloudPlatform#2899)

* add support for buckets

* add project-level interpolation for own SAs

* docs

* project reuse changes

* fix example

* tfdoc

* update check documentation tool

* fast tests

* blueprints

* typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants