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

Commit 913d307

Browse files
ndegoryDavid Chung
authored andcommitted
Terraform plugin and Logical IDs allocation (#392)
Signed-off-by: Nicolas Degory <[email protected]>
1 parent b919e4f commit 913d307

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cmd/cli/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func managerCommand(plugins func() discovery.Plugins) *cobra.Command {
163163
return err
164164
}
165165

166-
// the format is pluing.Spec
166+
// the format is plugin.Spec
167167
out := []plugin.Spec{}
168168
for _, spec := range specs {
169169

examples/instance/terraform/plugin.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func (p *plugin) Provision(spec instance.Spec) (*instance.ID, error) {
385385

386386
// Use tag to store the logical id
387387
if spec.LogicalID != nil {
388-
if m, ok := properties.Value["tags"].(map[string]string); ok {
388+
if m, ok := properties.Value["tags"].(map[string]interface{}); ok {
389389
m["LogicalID"] = string(*spec.LogicalID)
390390
}
391391
}
@@ -603,7 +603,11 @@ func terraformLogicalID(v interface{}) *instance.LogicalID {
603603
if !ok {
604604
return nil
605605
}
606-
v, exists := m["tags.LogicalID"]
606+
tags, ok := m["tags"].(map[string]interface{})
607+
if !ok {
608+
return nil
609+
}
610+
v, exists := tags["LogicalID"]
607611
if exists {
608612
id := instance.LogicalID(fmt.Sprintf("%v", v))
609613
return &id

0 commit comments

Comments
 (0)