2014-05-30 02:28:38 +02:00
|
|
|
package aws
|
|
|
|
|
2014-06-03 23:26:31 +02:00
|
|
|
import (
|
2014-06-18 18:33:13 +02:00
|
|
|
"fmt"
|
|
|
|
|
2014-06-03 23:26:31 +02:00
|
|
|
"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
|
|
|
|
}
|
|
|
|
|
|
|
|
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-03 23:26:31 +02:00
|
|
|
|
|
|
|
func (p *ResourceProvider) Resources() []terraform.ResourceType {
|
2014-06-10 20:34:14 +02:00
|
|
|
return []terraform.ResourceType{
|
|
|
|
terraform.ResourceType{
|
|
|
|
Name: "aws_instance",
|
|
|
|
},
|
|
|
|
}
|
2014-06-03 23:26:31 +02:00
|
|
|
}
|