feat: display ec2 instance name when tag name exist

main
sundowndev 2021-04-30 10:39:07 +02:00
parent bcff002e50
commit 62f6f997b7
1 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,10 @@
package aws
import "github.com/cloudskiff/driftctl/pkg/resource"
import (
"fmt"
"github.com/cloudskiff/driftctl/pkg/resource"
)
func (r *AwsInstance) NormalizeForState() (resource.Resource, error) {
if r.RootBlockDevice != nil && len(*r.RootBlockDevice) == 0 {
@ -21,3 +25,10 @@ func (r *AwsInstance) NormalizeForProvider() (resource.Resource, error) {
}
return r, nil
}
func (r *AwsInstance) String() string {
if name, ok := r.Tags["Name"]; ok {
return fmt.Sprintf("%s (Name: %s)", r.TerraformId(), name)
}
return r.TerraformId()
}