From 523efdf457d98b8bfd9522dd0614d884620e017a Mon Sep 17 00:00:00 2001 From: "hashicorp-tsccr[bot]" <129506189+hashicorp-tsccr[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 16:01:36 -0400 Subject: [PATCH] SEC-090: Automated trusted workflow pinning (2024-08-19) (#601) * Result of tsccr-helper -log-level=info gha update -latest . * Resolve linter errors and warnings --------- Co-authored-by: hashicorp-tsccr[bot] Co-authored-by: Selena Goods --- .github/workflows/release.yml | 2 +- .golangci.yml | 2 +- internal/provider/resource_integer.go | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be90c11f..bb9ada11 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,7 +89,7 @@ jobs: cd .changes sed -e "1{/# /d;}" -e "2{/^$/d;}" ${{ needs.changelog-version.outputs.version }}.md > release-notes.txt - - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5 + - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: release-notes path: ./.changes/release-notes.txt diff --git a/.golangci.yml b/.golangci.yml index c32adeaa..79ad0c08 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,7 +22,7 @@ linters: - unconvert - unparam - unused - - vet + - govet run: # Prevent false positive timeouts in CI diff --git a/internal/provider/resource_integer.go b/internal/provider/resource_integer.go index 91293e09..63a52f4b 100644 --- a/internal/provider/resource_integer.go +++ b/internal/provider/resource_integer.go @@ -101,26 +101,26 @@ func (r *integerResource) Create(ctx context.Context, req resource.CreateRequest return } - max := int(plan.Max.ValueInt64()) - min := int(plan.Min.ValueInt64()) + maxVal := int(plan.Max.ValueInt64()) + minVal := int(plan.Min.ValueInt64()) seed := plan.Seed.ValueString() - if max < min { + if maxVal < minVal { resp.Diagnostics.AddError( "Create Random Integer Error", - "The minimum (min) value needs to be smaller than or equal to maximum (max) value.", + "The minimum (minVal) value needs to be smaller than or equal to maximum (maxVal) value.", ) return } rand := random.NewRand(seed) - number := rand.Intn((max+1)-min) + min + number := rand.Intn((maxVal+1)-minVal) + minVal u := &integerModelV0{ ID: types.StringValue(strconv.Itoa(number)), Keepers: plan.Keepers, - Min: types.Int64Value(int64(min)), - Max: types.Int64Value(int64(max)), + Min: types.Int64Value(int64(minVal)), + Max: types.Int64Value(int64(maxVal)), Result: types.Int64Value(int64(number)), } @@ -179,7 +179,7 @@ func (r *integerResource) ImportState(ctx context.Context, req resource.ImportSt return } - min, err := strconv.ParseInt(parts[1], 10, 64) + minVal, err := strconv.ParseInt(parts[1], 10, 64) if err != nil { resp.Diagnostics.AddError( "Import Random Integer Error", @@ -189,7 +189,7 @@ func (r *integerResource) ImportState(ctx context.Context, req resource.ImportSt return } - max, err := strconv.ParseInt(parts[2], 10, 64) + maxVal, err := strconv.ParseInt(parts[2], 10, 64) if err != nil { resp.Diagnostics.AddError( "Import Random Integer Error", @@ -204,8 +204,8 @@ func (r *integerResource) ImportState(ctx context.Context, req resource.ImportSt state.ID = types.StringValue(parts[0]) state.Keepers = types.MapNull(types.StringType) state.Result = types.Int64Value(result) - state.Min = types.Int64Value(min) - state.Max = types.Int64Value(max) + state.Min = types.Int64Value(minVal) + state.Max = types.Int64Value(maxVal) if len(parts) == 4 { state.Seed = types.StringValue(parts[3])