diff: don't magically put ID in there, assumed if not set

This commit is contained in:
Mitchell Hashimoto 2014-06-23 13:14:08 -07:00
parent c5a621a47a
commit 9b4b89c16c
3 changed files with 7 additions and 14 deletions

View File

@ -29,6 +29,10 @@ func (p *ResourceProvider) Apply(
ID: "foo",
}
result = result.MergeDiff(d)
result.Attributes["public_dns"] = "foo"
result.Attributes["public_ip"] = "foo"
result.Attributes["private_dns"] = "foo"
result.Attributes["private_ip"] = "foo"
return result, nil
}

View File

@ -64,13 +64,6 @@ func (b *ResourceBuilder) Diff(
// If we require a new resource, then process all the attributes
// that will be changing due to the creation of the resource.
if requiresNew {
attrs["id"] = &terraform.ResourceAttrDiff{
Old: s.ID,
NewComputed: true,
RequiresNew: true,
Type: terraform.DiffAttrOutput,
}
for _, k := range b.CreateComputedAttrs {
old := s.Attributes[k]
attrs[k] = &terraform.ResourceAttrDiff{

View File

@ -144,24 +144,20 @@ func TestResourceBuilder_vars(t *testing.T) {
}
}
const testRBNewDiff = `CREATE
const testRBNewDiff = `UPDATE
IN foo: "" => "bar"
OUT id: "" => "<computed>" (forces new resource)
OUT private_ip: "" => "<computed>"
`
const testRBRequiresNewDiff = `CREATE
IN ami: "foo" => "bar" (forces new resource)
OUT id: "1" => "<computed>" (forces new resource)
OUT private_ip: "127.0.0.1" => "<computed>"
`
const testRBUnknownDiff = `CREATE
const testRBUnknownDiff = `UPDATE
IN foo: "" => "${var.unknown}"
OUT id: "" => "<computed>" (forces new resource)
`
const testRBVarsDiff = `CREATE
const testRBVarsDiff = `UPDATE
IN foo: "" => "bar"
OUT id: "" => "<computed>" (forces new resource)
`