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

job: import jobs from non-default namespace #408

Merged
merged 5 commits into from
Dec 19, 2023
Merged

Commits on Dec 19, 2023

  1. import: add helper to import namespaced resources

    `nomad_job`, `nomad_csi_volume`, and `nomad_csi_volume_registration` do
    not have the namespace as part of their state ID. This makes it
    impossible to import them if they are registered in a non-default
    namespace since only the ID is provided to the import function.
    
    This commit adds a new helper that imports using an ID with the format
    `<id>@<namespace>`. Since `@` is not a valid character for namespaces,
    the last `@` character (if found) represents the separator.
    lgfa29 committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    e8f2876 View commit details
    Browse the repository at this point in the history
  2. changelog: add entry for #408

    lgfa29 committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    f2f8c8a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bc8f90a View commit details
    Browse the repository at this point in the history
  4. provider: fix namespaced importer

    Importing namespaced resources require a namespace to be passed. Without
    this requirement jobs such as `a@b` become ambiguous as it's not
    possible to determine if the user intention was to import the job named
    `a` from namespace `b` or job `a@b` on namespace `default`. By requiring
    a namespace to be set this ambiguity is solved.
    
    Additionally, Terraform automatically refreshes the state after an
    import, so there is no need to call the `Read` method manually on
    import. Doing so can also have unintended consequences, as the provider
    deletes resources from state in case of a `404`, resulting in a
    Terraform error when trying to import resources that don't exist.
    lgfa29 committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    d499c79 View commit details
    Browse the repository at this point in the history
  5. apply code review

    lgfa29 committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    83ce1a9 View commit details
    Browse the repository at this point in the history