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

Add an option for tfe_registry_module to wait for version ingress #1359

Open
danbarr opened this issue May 15, 2024 · 0 comments
Open

Add an option for tfe_registry_module to wait for version ingress #1359

danbarr opened this issue May 15, 2024 · 0 comments

Comments

@danbarr
Copy link

danbarr commented May 15, 2024

Use-cases

It is currently not possible to create a tfe_registry_module and the corresponding tfe_no_code_module variable_options definitions in a single apply.

When the tfe_no_code_module resource is created immediately after the tfe_registry_module but before a version has ingressed, the no-code module has no version to pin to and read the required input variables from. The variable_options do not actually get set on the no-code settings, even though the apply apparently succeeds. A second apply actually adds them.

Further, if you explicitly set the tfe_no_code_module.version_pin value, the apply will error:

│ Error: Error creating no-code module for registry module mod-tF5Ama5MJAsNPy6H: unprocessable entity
│ 
│ Validation failed: Provided version pin is not equal to latest or provided string does not represent an existing version of the module.

Attempted Solutions

I am only able to solve this by inserting a time_sleep resource between the tfe_registry_module and tfe_no_code_module resources, but this is arbitrary and subject to fail depending on the amount of time needed to ingress the first version.

resource "tfe_registry_module" "example" {
  ...
}

resource "time_sleep" "module_ingress_delay" {
  create_duration = "10s"

  depends_on = [tfe_registry_module.example]
}

resource "tfe_no_code_module" "example" {
  ...

  depends_on = [time_sleep.module_ingress_delay]
}

Proposal

I propose adding an optional wait_for_ingress (or similarly named) attribute to the vcs_repo block in tfe_registry_module, as such:

resource "tfe_registry_module" "example" {
  vcs_repo {
    display_identifier         = "my-org-name/terraform-provider-name"
    identifier                 = "my-org-name/terraform-provider-name"
    github_app_installation_id = data.tfe_github_app_installation.selected.id
    branch                     = "main"
    wait_for_ingress           = true
  }
}

The new attribute would default to false to preserve existing behavior.

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

No branches or pull requests

1 participant