/
provider.go
51 lines (43 loc) · 1.51 KB
/
provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package tf
import (
"context"
"github.com/hashicorp/terraform-plugin-framework/schema"
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
)
func New() tfsdk.Provider {
return &provider{}
}
type provider struct {
ImageAuthSecret types.String `tfsdk:"image_auth_secret"`
}
func (p *provider) GetSchema(ctx context.Context) (schema.Schema, []*tfprotov6.Diagnostic) {
return schema.Schema{
Attributes: map[string]schema.Attribute{
"image_auth_secret": {
Type: types.StringType,
Required: false,
},
},
}, nil
}
func (p *provider) Configure(ctx context.Context, request tfsdk.ConfigureProviderRequest, response *tfsdk.ConfigureProviderResponse) {
err := request.Config.Get(ctx, p)
if err != nil {
response.Diagnostics = append(response.Diagnostics, &tfprotov6.Diagnostic{
Severity: tfprotov6.DiagnosticSeverityError,
Summary: "Error reading configuration",
Detail: "An unexpected error was encountered while reading configuration: " + err.Error(),
})
return
}
}
func (p *provider) GetResources(ctx context.Context) (map[string]tfsdk.ResourceType, []*tfprotov6.Diagnostic) {
return map[string]tfsdk.ResourceType{}, nil
}
func (p *provider) GetDataSources(ctx context.Context) (map[string]tfsdk.DataSourceType, []*tfprotov6.Diagnostic) {
return map[string]tfsdk.DataSourceType{
"kilt_fargate_container_definitions": dataSourceFargateContainerDefinitions{provider: p},
}, nil
}