terraform: ResourceAddress should output instance type if set

This commit is contained in:
Mitchell Hashimoto 2016-04-11 17:03:25 -07:00
parent 4faa6b37e4
commit 407be65cc8
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 10 additions and 6 deletions

View File

@ -52,11 +52,15 @@ func (r *ResourceAddress) String() string {
if r.Name != "" {
name := r.Name
switch r.InstanceType {
case TypeDeposed:
name += ".deposed"
case TypeTainted:
name += ".tainted"
if r.InstanceTypeSet {
switch r.InstanceType {
case TypePrimary:
name += ".primary"
case TypeDeposed:
name += ".deposed"
case TypeTainted:
name += ".tainted"
}
}
if r.Index >= 0 {

View File

@ -50,7 +50,7 @@ func TestParseResourceAddress(t *testing.T) {
InstanceTypeSet: true,
Index: 2,
},
"aws_instance.foo[2]",
"",
},
"tainted": {
"aws_instance.foo.tainted",