helper/diff: add ID to diff
This commit is contained in:
parent
a31c4e8788
commit
177f8c094d
|
@ -108,6 +108,13 @@ func (b *ResourceBuilder) Diff(
|
|||
Type: terraform.DiffAttrOutput,
|
||||
}
|
||||
}
|
||||
|
||||
// The ID will change
|
||||
attrs["id"] = &terraform.ResourceAttrDiff{
|
||||
Old: s.ID,
|
||||
NewComputed: true,
|
||||
Type: terraform.DiffAttrOutput,
|
||||
}
|
||||
}
|
||||
|
||||
// Build our resulting diff if we had attributes change
|
||||
|
|
|
@ -202,18 +202,22 @@ const testRBComplexDiff = `UPDATE
|
|||
|
||||
const testRBNewDiff = `UPDATE
|
||||
IN foo: "" => "bar"
|
||||
OUT id: "" => "<computed>"
|
||||
OUT private_ip: "" => "<computed>"
|
||||
`
|
||||
|
||||
const testRBRequiresNewDiff = `CREATE
|
||||
IN ami: "foo" => "bar" (forces new resource)
|
||||
OUT id: "1" => "<computed>"
|
||||
OUT private_ip: "127.0.0.1" => "<computed>"
|
||||
`
|
||||
|
||||
const testRBUnknownDiff = `UPDATE
|
||||
IN foo: "" => "${var.unknown}"
|
||||
OUT id: "" => "<computed>"
|
||||
`
|
||||
|
||||
const testRBVarsDiff = `UPDATE
|
||||
IN foo: "" => "bar"
|
||||
OUT id: "" => "<computed>"
|
||||
`
|
||||
|
|
|
@ -222,7 +222,23 @@ UPDATE: aws_instance.bar
|
|||
foo: "" => "<computed>"
|
||||
type: "" => "aws_instance"
|
||||
UPDATE: aws_instance.foo
|
||||
id: "" => "<computed>"
|
||||
foo: "" => "<computed>"
|
||||
num: "" => "2"
|
||||
type: "" => "aws_instance"
|
||||
|
||||
STATE:
|
||||
|
||||
<no state>
|
||||
`
|
||||
|
||||
const testTerraformPlanComputedIdStr = `
|
||||
DIFF:
|
||||
|
||||
UPDATE: aws_instance.bar
|
||||
foo: "" => "<computed>"
|
||||
type: "" => "aws_instance"
|
||||
UPDATE: aws_instance.foo
|
||||
foo: "" => "<computed>"
|
||||
num: "" => "2"
|
||||
type: "" => "aws_instance"
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
resource "aws_instance" "foo" {
|
||||
num = "2"
|
||||
compute = "id"
|
||||
compute = "foo"
|
||||
}
|
||||
|
||||
resource "aws_instance" "bar" {
|
||||
foo = "${aws_instance.foo.id}"
|
||||
foo = "${aws_instance.foo.foo}"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue