helper/schema: computed values should not be Get-able

This commit is contained in:
Mitchell Hashimoto 2014-08-18 15:10:53 -07:00
parent 4ae1673580
commit 3800dffdeb
2 changed files with 28 additions and 1 deletions

View File

@ -273,7 +273,7 @@ func (d *ResourceData) getPrimitive(
if d.diff != nil && source >= getSourceDiff {
attrD, ok := d.diff.Attributes[k]
if ok {
if ok && !attrD.NewComputed {
result = attrD.New
resultSet = true
}

View File

@ -15,6 +15,33 @@ func TestResourceDataGet(t *testing.T) {
Key string
Value interface{}
}{
{
Schema: map[string]*Schema{
"availability_zone": &Schema{
Type: TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
},
State: nil,
Diff: &terraform.ResourceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
New: "",
NewComputed: true,
},
},
},
Key: "availability_zone",
Value: nil,
},
{
Schema: map[string]*Schema{
"availability_zone": &Schema{