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 != "" {
|
if r.Name != "" {
|
||||||
name := r.Name
|
name := r.Name
|
||||||
|
if r.InstanceTypeSet {
|
||||||
switch r.InstanceType {
|
switch r.InstanceType {
|
||||||
|
case TypePrimary:
|
||||||
|
name += ".primary"
|
||||||
case TypeDeposed:
|
case TypeDeposed:
|
||||||
name += ".deposed"
|
name += ".deposed"
|
||||||
case TypeTainted:
|
case TypeTainted:
|
||||||
name += ".tainted"
|
name += ".tainted"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if r.Index >= 0 {
|
if r.Index >= 0 {
|
||||||
name += fmt.Sprintf("[%d]", r.Index)
|
name += fmt.Sprintf("[%d]", r.Index)
|
||||||
|
|
|
@ -50,7 +50,7 @@ func TestParseResourceAddress(t *testing.T) {
|
||||||
InstanceTypeSet: true,
|
InstanceTypeSet: true,
|
||||||
Index: 2,
|
Index: 2,
|
||||||
},
|
},
|
||||||
"aws_instance.foo[2]",
|
"",
|
||||||
},
|
},
|
||||||
"tainted": {
|
"tainted": {
|
||||||
"aws_instance.foo.tainted",
|
"aws_instance.foo.tainted",
|
||||||
|
|
Loading…
Reference in New Issue