terraform: ResourceAddress should output instance type if set
This commit is contained in:
parent
4faa6b37e4
commit
407be65cc8
|
@ -52,12 +52,16 @@ func (r *ResourceAddress) String() string {
|
|||
|
||||
if r.Name != "" {
|
||||
name := r.Name
|
||||
if r.InstanceTypeSet {
|
||||
switch r.InstanceType {
|
||||
case TypePrimary:
|
||||
name += ".primary"
|
||||
case TypeDeposed:
|
||||
name += ".deposed"
|
||||
case TypeTainted:
|
||||
name += ".tainted"
|
||||
}
|
||||
}
|
||||
|
||||
if r.Index >= 0 {
|
||||
name += fmt.Sprintf("[%d]", r.Index)
|
||||
|
|
|
@ -50,7 +50,7 @@ func TestParseResourceAddress(t *testing.T) {
|
|||
InstanceTypeSet: true,
|
||||
Index: 2,
|
||||
},
|
||||
"aws_instance.foo[2]",
|
||||
"",
|
||||
},
|
||||
"tainted": {
|
||||
"aws_instance.foo.tainted",
|
||||
|
|
Loading…
Reference in New Issue