Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Include LogicalID in name of terraform resource #555

Closed
kaufers opened this issue May 19, 2017 · 1 comment
Closed

Include LogicalID in name of terraform resource #555

kaufers opened this issue May 19, 2017 · 1 comment

Comments

@kaufers
Copy link
Contributor

kaufers commented May 19, 2017

Currently, the hostname for the Softlayer terraform resource is either the instance name (ie, "instance-12345") if the @hostname_prefix property is not set; else it's formatted as <@hostname_prefix>-<timestamp> (ie, "given-prefix-12345).

This approach makes sense for workers but having a more predictable naming scheme for managers would be more usable. Instead of using the random timestamp could we just use the LogicalID?

Then, for example, a manager with a LogicalID of mgr-1 would either have a hostname of:

  • mgr-1 (if no hostname prefix is specified)
  • <given-prefix>-mgr-1

My only concern here would be collisions. If a manager was in the process of being deleted then there might be a conflict until the VM was actually removed; but then the next terraform apply would work.

Can we also use the LogicalID for the instance name? Then the managers would be named something like instance-mgr-1 and the associated file would be instance-mgr-1.tf.json. Again, we'd need to check for file collisions.

Thoughts on this @chungers? Thanks!

kaufers added a commit to kaufers/infrakit that referenced this issue May 22, 2017
Currently, the hostname for the Softlayer terraform resource is either the instance
name (ie, "instance-12345") if the `@hostname_prefix` property is not set; else it's
formatted as `<@hostname_prefix>-<timestamp>` (ie, "given-prefix-12345).

This approach makes sense for workers but having a more predictable naming scheme for
managers would be more usable. This commit updates the naming scheme to use the
`LogicalID` (if set) instead of the timestamp when generating the hostname.

See issue docker-archive#555.

Note that the instance name remains unchanged; it's only the `hostname` property that
is being updated.

Signed-off-by: Steven Kaufer <kaufer@us.ibm.com>
kaufers added a commit to kaufers/infrakit that referenced this issue May 22, 2017
Currently, the hostname for the Softlayer terraform resource is either the instance
name (ie, "instance-12345") if the `@hostname_prefix` property is not set; else it's
formatted as `<@hostname_prefix>-<timestamp>` (ie, "given-prefix-12345).

This approach makes sense for workers but having a more predictable naming scheme for
managers would be more usable. This commit updates the naming scheme to use the
`LogicalID` (if set) instead of the timestamp when generating the hostname.

See issue docker-archive#555.

Note that the instance name remains unchanged; it's only the `hostname` property that
is being updated.

Signed-off-by: Steven Kaufer <kaufer@us.ibm.com>
@kaufers
Copy link
Contributor Author

kaufers commented May 23, 2017

PR 558 addressed updating the hostname with the logical ID. The outstanding part of this issue deals with the naming of the instance; should the instance (and the associated file) still have the timestamp suffix or should it use the logical ID?

Note that the code currently looks for files that match (^instance-[0-9]+)(.tf.json) and nested instances named (.*)(instance-[0-9]+). Can these just be updated handle files/names that start with instance-?

@kaufers kaufers closed this as completed Jan 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant