terraform/builtin/providers/aws/resource_provider.go

59 lines
1.1 KiB
Go
Raw Normal View History

2014-05-30 02:28:38 +02:00
package aws
import (
2014-06-18 18:33:13 +02:00
"fmt"
"github.com/hashicorp/terraform/terraform"
)
2014-05-30 02:28:38 +02:00
type ResourceProvider struct {
}
2014-06-13 08:08:47 +02:00
func (p *ResourceProvider) Validate(c *terraform.ResourceConfig) ([]string, []error) {
errs := c.CheckSet([]string{
"access_key",
"secret_key",
})
return nil, errs
2014-06-13 07:39:29 +02:00
}
2014-06-13 07:15:36 +02:00
func (p *ResourceProvider) Configure(*terraform.ResourceConfig) error {
2014-06-07 05:17:38 +02:00
return nil
}
2014-06-19 01:52:21 +02:00
func (p *ResourceProvider) Apply(
s *terraform.ResourceState,
d *terraform.ResourceDiff) (*terraform.ResourceState, error) {
result := &terraform.ResourceState{
ID: "foo",
}
2014-06-19 23:08:48 +02:00
result = result.MergeDiff(d)
2014-06-19 01:52:21 +02:00
return result, nil
}
2014-06-07 05:17:38 +02:00
func (p *ResourceProvider) Diff(
s *terraform.ResourceState,
2014-06-13 07:15:36 +02:00
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
2014-06-18 18:33:13 +02:00
b := diffMap.Get(s.Type)
if b == nil {
return nil, fmt.Errorf("Unknown type: %s", s.Type)
}
return b.Diff(s, c)
2014-05-30 02:28:38 +02:00
}
2014-06-20 20:52:21 +02:00
func (p *ResourceProvider) Refresh(
s *terraform.ResourceState) (*terraform.ResourceState, error) {
return s, nil
}
func (p *ResourceProvider) Resources() []terraform.ResourceType {
2014-06-10 20:34:14 +02:00
return []terraform.ResourceType{
terraform.ResourceType{
Name: "aws_instance",
},
}
}