mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-15 19:22:46 -06:00
62 lines
1.1 KiB
Go
62 lines
1.1 KiB
Go
package aws
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
type ResourceProvider struct {
|
|
}
|
|
|
|
func (p *ResourceProvider) Validate(c *terraform.ResourceConfig) ([]string, []error) {
|
|
errs := c.CheckSet([]string{
|
|
"access_key",
|
|
"secret_key",
|
|
})
|
|
|
|
return nil, errs
|
|
}
|
|
|
|
func (p *ResourceProvider) Configure(*terraform.ResourceConfig) error {
|
|
return nil
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
func (p *ResourceProvider) Resources() []terraform.ResourceType {
|
|
return []terraform.ResourceType{
|
|
terraform.ResourceType{
|
|
Name: "aws_instance",
|
|
},
|
|
}
|
|
}
|