@@ -29,18 +29,15 @@ type TerrakubeProvider struct {
29
29
30
30
// hashicupsProviderModel maps provider schema data to a Go type.
31
31
type TerrakubeProviderModel struct {
32
- Endpoint types.String `tfsdk:"endpoint"`
33
- Token types.String `tfsdk:"token"`
34
- }
35
-
36
- // ScaffoldingProviderModel describes the provider data model.
37
- type ScaffoldingProviderModel struct {
38
- Endpoint types.String `tfsdk:"endpoint"`
32
+ Endpoint types.String `tfsdk:"endpoint"`
33
+ Token types.String `tfsdk:"token"`
34
+ InsecureHttpClient types.Bool `tfsdk:"insecure_http_client"`
39
35
}
40
36
41
37
type TerrakubeConnectionData struct {
42
- Endpoint string
43
- Token string
38
+ Endpoint string
39
+ Token string
40
+ InsecureHttpClient bool
44
41
}
45
42
46
43
func New (version string ) func () provider.Provider {
@@ -67,6 +64,10 @@ func (p *TerrakubeProvider) Schema(ctx context.Context, req provider.SchemaReque
67
64
Required : true ,
68
65
Description : "Personal Access Token generated in Terrakube UI (https://docs.terrakube.io/user-guide/organizations/api-tokens)" ,
69
66
},
67
+ "insecure_http_client" : schema.BoolAttribute {
68
+ Optional : true ,
69
+ Description : "Disable https certificate validation" ,
70
+ },
70
71
},
71
72
}
72
73
}
@@ -108,6 +109,7 @@ func (p *TerrakubeProvider) Configure(ctx context.Context, req provider.Configur
108
109
109
110
endpoint := os .Getenv ("TERRAKUBE_ENDPOINT" )
110
111
token := os .Getenv ("TERRAKUBE_TOKEN" )
112
+ insecureHttpClient := false
111
113
112
114
if ! config .Endpoint .IsNull () {
113
115
endpoint = config .Endpoint .ValueString ()
@@ -117,6 +119,10 @@ func (p *TerrakubeProvider) Configure(ctx context.Context, req provider.Configur
117
119
token = config .Token .ValueString ()
118
120
}
119
121
122
+ if ! config .InsecureHttpClient .IsNull () {
123
+ insecureHttpClient = config .InsecureHttpClient .ValueBool ()
124
+ }
125
+
120
126
// If any of the expected configurations are missing, return
121
127
// errors with provider-specific guidance.
122
128
@@ -148,6 +154,7 @@ func (p *TerrakubeProvider) Configure(ctx context.Context, req provider.Configur
148
154
149
155
connection .Endpoint = endpoint
150
156
connection .Token = token
157
+ connection .InsecureHttpClient = insecureHttpClient
151
158
152
159
resp .DataSourceData = connection
153
160
resp .ResourceData = connection
0 commit comments