providers/aws: use new diff package
This commit is contained in:
parent
847cd7ac51
commit
0d557a605f
|
@ -0,0 +1,33 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/diff"
|
||||
)
|
||||
|
||||
var diffBuilder *diff.LazyResourceMap
|
||||
|
||||
func init() {
|
||||
diffBuilder = &diff.LazyResourceMap{
|
||||
Resources: map[string]diff.ResourceBuilderFactory{
|
||||
"aws_instance": diffBuilder_aws_instance,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func diffBuilder_aws_instance() *diff.ResourceBuilder {
|
||||
return &diff.ResourceBuilder{
|
||||
CreateComputedAttrs: []string{
|
||||
"public_dns",
|
||||
"public_ip",
|
||||
"private_dns",
|
||||
"private_ip",
|
||||
},
|
||||
|
||||
RequiresNewAttrs: []string{
|
||||
"ami",
|
||||
"availability_zone",
|
||||
"instance_type",
|
||||
"region",
|
||||
},
|
||||
}
|
||||
}
|
|
@ -23,33 +23,7 @@ func (p *ResourceProvider) Configure(*terraform.ResourceConfig) error {
|
|||
func (p *ResourceProvider) Diff(
|
||||
s *terraform.ResourceState,
|
||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
||||
diffMap.CreateAttrs([]string{
|
||||
"ami",
|
||||
"availability_zone",
|
||||
"instance_type",
|
||||
"region",
|
||||
})
|
||||
diffMap.CreateComputedAttrs([]string{
|
||||
"id",
|
||||
"public_dns",
|
||||
"public_ip",
|
||||
"private_dns",
|
||||
"private_ip",
|
||||
})
|
||||
|
||||
return &terraform.ResourceDiff{
|
||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||
"id": &terraform.ResourceAttrDiff{
|
||||
Old: "",
|
||||
NewComputed: true,
|
||||
RequiresNew: true,
|
||||
},
|
||||
"created": &terraform.ResourceAttrDiff{
|
||||
Old: "false",
|
||||
New: "true",
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (p *ResourceProvider) Resources() []terraform.ResourceType {
|
||||
|
|
Loading…
Reference in New Issue