Skip to content

Commit 6dd134d

Browse files
committed
CDPCP-15624 - environment deployment fails if freeipa.architecture is not given
1 parent a08e34d commit 6dd134d

18 files changed

+96
-42
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
terraform_wrapper: false
4444

4545
- name: Run linters
46-
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
46+
uses: golangci/golangci-lint-action@v8.0.0
4747
with:
4848
args: --timeout 3m
4949

@@ -67,7 +67,7 @@ jobs:
6767
with:
6868
go-version-file: 'go.mod'
6969
- name: Run linters
70-
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
70+
uses: golangci/golangci-lint-action@v8.0.0
7171
with:
7272
args: --timeout 3m
7373

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ workspace.xml
1313
**/.terraform
1414
**/terraform.tfstate
1515
**/terraform.tfstate.backup
16+
**/.terraform.tfstate.lock.info
1617

1718
# Coverage related report file(s)
1819
coverage.*

.golangci.yml

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,47 @@
1-
---
1+
version: "2"
22
run:
33
tests: true
4-
4+
output:
5+
formats:
6+
text:
7+
path: stdout
8+
print-issued-lines: true
59
linters:
6-
disable-all: true
10+
default: none
711
enable:
812
- errcheck
9-
- gosimple
1013
- govet
1114
- ineffassign
1215
- staticcheck
1316
- unused
14-
- gci
15-
16-
linters-settings:
17-
gci:
18-
sections:
19-
- standard # Standard section: captures all standard packages.
20-
- default # Default section: contains all imports that could not be matched to another section type.
21-
- prefix(github.com/cloudera/terraform-provider-cdp) # Custom section: groups all imports with the specified Prefix.
22-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
23-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
24-
# Skip generated files.
25-
# Default: true
26-
skip-generated: true
27-
28-
output:
29-
formats:
30-
- format: colored-line-number
31-
path: stdout
32-
print-issued-lines: true
33-
17+
exclusions:
18+
generated: lax
19+
presets:
20+
- comments
21+
- common-false-positives
22+
- legacy
23+
- std-error-handling
24+
paths:
25+
- third_party$
26+
- builtin$
27+
- examples$
3428
issues:
3529
max-issues-per-linter: 0
3630
max-same-issues: 0
31+
formatters:
32+
enable:
33+
- gci
34+
settings:
35+
gci:
36+
sections:
37+
- standard
38+
- default
39+
- prefix(github.com/cloudera/terraform-provider-cdp)
40+
- blank
41+
- dot
42+
exclusions:
43+
generated: lax
44+
paths:
45+
- third_party$
46+
- builtin$
47+
- examples$

resources/datahub/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
func checkIfClusterCreationFailed(resp *operations.DescribeClusterOK) (interface{}, string, error) {
2121
if utils.ContainsAsSubstring(failedStatusKeywords, resp.GetPayload().Cluster.Status) {
22-
return nil, "", fmt.Errorf("Cluster status became unacceptable: %s", resp.GetPayload().Cluster.Status)
22+
return nil, "", fmt.Errorf("cluster status became unacceptable: %s", resp.GetPayload().Cluster.Status)
2323
}
2424
return resp, resp.GetPayload().Cluster.Status, nil
2525
}

resources/datalake/resource_aws_datalake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (r *awsDatalakeResource) Create(ctx context.Context, req resource.CreateReq
140140
return
141141
}
142142

143-
if !(state.PollingOptions != nil && state.PollingOptions.Async.ValueBool()) {
143+
if state.PollingOptions == nil || !state.PollingOptions.Async.ValueBool() {
144144
stateSaver := func(dlDtl *datalakemodels.DatalakeDetails) {
145145
datalakeDetailsToAwsDatalakeResourceModel(ctx, dlDtl, &state, state.PollingOptions, &resp.Diagnostics)
146146
diags = resp.State.Set(ctx, state)

resources/datalake/resource_azure_datalake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (r *azureDatalakeResource) Create(ctx context.Context, req resource.CreateR
143143
return
144144
}
145145

146-
if !(state.PollingOptions != nil && state.PollingOptions.Async.ValueBool()) {
146+
if state.PollingOptions == nil || !state.PollingOptions.Async.ValueBool() {
147147
stateSaver := func(dlDtl *datalakemodels.DatalakeDetails) {
148148
datalakeDetailsToAzureDatalakeResourceModel(ctx, dlDtl, &state, state.PollingOptions, &resp.Diagnostics)
149149
diags = resp.State.Set(ctx, state)

resources/datalake/resource_gcp_datalake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (r *gcpDatalakeResource) Create(ctx context.Context, req resource.CreateReq
8787
return
8888
}
8989

90-
if !(state.PollingOptions != nil && state.PollingOptions.Async.ValueBool()) {
90+
if state.PollingOptions == nil || !state.PollingOptions.Async.ValueBool() {
9191
stateSaver := func(dlDtl *datalakemodels.DatalakeDetails) {
9292
datalakeDetailsToGcpDatalakeResourceModel(ctx, dlDtl, &state, state.PollingOptions, &resp.Diagnostics)
9393
diags = resp.State.Set(ctx, state)

resources/dw/cluster/aws/resource_cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (r *dwClusterResource) Create(ctx context.Context, req resource.CreateReque
111111
return
112112
}
113113

114-
if !(plan.PollingOptions != nil && plan.PollingOptions.Async.ValueBool()) {
114+
if plan.PollingOptions == nil || !plan.PollingOptions.Async.ValueBool() {
115115
callFailedCount := 0
116116
stateConf := &retry.StateChangeConf{
117117
Pending: []string{"Accepted", "Creating", "Created", "Starting"},
@@ -168,7 +168,7 @@ func (r *dwClusterResource) Delete(ctx context.Context, req resource.DeleteReque
168168
return
169169
}
170170

171-
if !(state.PollingOptions != nil && state.PollingOptions.Async.ValueBool()) {
171+
if state.PollingOptions == nil || !state.PollingOptions.Async.ValueBool() {
172172
callFailedCount := 0
173173
stateConf := &retry.StateChangeConf{
174174
Pending: []string{"Deleting", "Running"},

resources/dw/databasecatalog/resource_catalog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (r *dwDatabaseCatalogResource) Create(ctx context.Context, req resource.Cre
6868

6969
clusterID := plan.ClusterID.ValueStringPointer()
7070

71-
if opts := plan.PollingOptions; !(opts != nil && opts.Async.ValueBool()) {
71+
if opts := plan.PollingOptions; opts == nil || !opts.Async.ValueBool() {
7272
callFailedCount := 0
7373
stateConf := &retry.StateChangeConf{
7474
Pending: []string{"Accepted", "Creating", "Created", "Loading", "Starting"},

resources/environments/converter_freeipa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func FreeIpaResponseToModel(ipaResp *environmentsmodels.FreeipaDetails, model *t
8888
Instances: ipaInstances,
8989
MultiAz: types.BoolValue(ipaResp.MultiAz),
9090
Recipes: recipes,
91-
Architecture: types.StringValue(freeIpaDetails.Architecture.ValueString()),
91+
Architecture: getStringValueIfNotEmpty(freeIpaDetails.Architecture.ValueString()),
9292
})
9393
diags.Append(ipaDiags...)
9494

0 commit comments

Comments
 (0)