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

Commit

Permalink
Fixes #393 - Terraform plugin private IP and logicalID allocation
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Degory <ndegory@axway.com>
  • Loading branch information
ndegory committed Feb 13, 2017
1 parent f00e0d3 commit 08f1d0a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/instance/terraform/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,20 @@ func (p *plugin) Provision(spec instance.Spec) (*instance.ID, error) {
m["LogicalID"] = string(*spec.LogicalID)
}
}
switch properties.Type {
case "aws_instance":
if p, exists := properties.Value["private_ip"]; exists {
if p == "INSTANCE_LOGICAL_ID" {
if spec.LogicalID != nil {
// set private IP to logical ID
properties.Value["private_ip"] = string(*spec.LogicalID)
} else {
// reset private IP (the tag is not relevant in this context)
delete(properties.Value, "private_ip")
}
}
}
}

// merge the inits
switch properties.Type {
Expand Down

0 comments on commit 08f1d0a

Please sign in to comment.