-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
foreman_host: Replace the "name" attribute with "fqdn" (computed) and…
… "shortname" (required) (#121) * Add more tracef log entries; small formattings * resourceForemanHost: Move resourceForemanHostCustomizeDiff in customdiff.All * Add fqdn and shortname attributes to Foreman host, handle name This commit introduces the new attributes "fqdn" and "shortname" to the Terraform provider for foreman_host objects. Formerly, the "name" attribute was used to configure and read the hostname of a host. But this value can be inconsistent, because Foreman might expand a short hostname to an FQDN, depending on a setting. (this is not a bug) Because of this unexpected behaviour (results in "inconstistent plan" in Terraform) the name attribute is now bypassed. Shortname is the new required input variable. Summary: * name: was required, is now optional and computed * fqdn: new, read-only, always returns the FQDN * shortname: required and checked for dots (".") to issue warnings Refs #116 * Add constructShortname func to Foreman host API wrapper "Shortname" does not exist in the Foreman API, only "name" which is either shortname or FQDN depending on a setting. For a more expected behaviour the shortname and fqdn fields were introduced. This commit fills the Shortname field in the ForemanHost API struct. * Allow name to not have dots * Fix shortname/fqdn tests; make name argument deprecated and read-only The tests use an API mock response file to check against a mocked Terraform schema. Since neither "shortname" nor "fqdn" host attributes are in the Foreman API, we exclude them in the tests. They are constructed from the "name" given by Foreman, or passed in in case of the shortname. To enforce the switch from "name" to "shortname", name is now a deprecated argument. It is still accessible via the name attribute, which is filled when the resource is read from the API. * Move resourceForemanHostCustomizeDiffComputeAttributes into extra func again
- Loading branch information
Showing
4 changed files
with
161 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.