Skip to content

Enhance terraform module publication docs and error messages

What does this MR do and why?

When publishing a terraform module, two duplication checks are performed in the Packages::TerraformModule::CreatePackageService:

  1. If the duplicates are allowed in the namespace's settings, the check is ignored. Otherwise, the service checks if the root namespace has an existing module with the same name in any other project. Here we need to be aware of two things:

    • Only the module's name is used to detect the duplicates. The version isn't used in this duplication check on the root namespace level.
    • The check looks for the duplicates in all other projects under the same root namespace, but it ignores the project the module is being published to. This is because we will have a 2nd check on the project level.

    If duplicates aren't allowed and the check detected duplicates, an error is returned informing the user that a module with the same name already exists in the namespace.

  2. The service checks if the project have an existing module with the same name & version. If so, an error is returned to the user.

So in order to make things clearer, this MR aims to enhance the documentation and error messages in the service, so that it's easier to distinguish the project & namespace duplication levels.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

N/A

How to set up and validate locally

N/A

Related to #504958 (closed)

Edited by Moaz Khalifa

Merge request reports

Loading