Skip to content

Add write operations for instance environment variables - #369

Merged
eamonnotoole merged 1 commit into
tf-devfrom
morph-612-instance-envs-write
Sep 18, 2026
Merged

eamonnotoole merged 1 commit into
tf-devfrom
morph-612-instance-envs-write

Conversation

@eamonnotoole

Copy link
Copy Markdown
Contributor

Summary

Documents the two operations Morpheus already exposes for an instance's user-defined environment variables, alongside the existing GET /api/instances/{id}/envs:

  • POST /api/instances/{id}/envs (addEnvVariables) — adds variables, or updates existing ones matched by name. Variables not listed are left unchanged.
  • DELETE /api/instances/{id}/envs/{name} (deleteEnvVariable) — removes the named variable.

Both return the same instanceEnvs response as the read.

Verified behaviour

Checked against a live appliance:

  • A repeated POST for an existing name replaces its value rather than duplicating the variable (upsert semantics).
  • DELETE by name removes exactly that variable.
  • Both echo the full environment (envs + readOnlyEnvs) in the response.

Changes

  • paths/api@instances@id@envs.yaml — add the post operation
  • paths/api@instances@id@envs@name.yaml — new path with the delete operation; registered in openapi.yaml
  • components/schemas/instanceEnvsAdd.yaml — request body (envs[] of {name, value, export?, masked?})
  • components/parameters/envName-path.yaml — the {name} path parameter
  • components/examples/instanceEnvsAdd.json — request example

The bundler validates cleanly and the generated Go client gains the two operations as a purely additive change.

Why

The Terraform provider's hpe_morpheus_instance resource could not apply environment-variable changes on update, because the instance update request does not carry them and the client only had the read. These operations let it diff and apply adds, modifications and removals.

Document the two operations Morpheus already exposes for user-defined
instance environment variables alongside the existing read:

- POST /api/instances/{id}/envs -- adds variables, or updates existing ones
  matched by name; variables not listed are left unchanged.
- DELETE /api/instances/{id}/envs/{name} -- removes the named variable.

Both return the same envs response as the read. Verified against a live
appliance: a repeated POST for an existing name replaces its value rather
than duplicating it.
@eamonnotoole
eamonnotoole merged commit fed9231 into tf-dev Sep 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants