From 370e5e7499c7f098e1a592f3406aba8899d230a0 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Fri, 17 Nov 2023 12:04:48 +0000 Subject: [PATCH 1/6] Update PR action to automatically add labels based on the PR title --- .github/pr-labeler.yml | 3 +++ .github/workflows/pull-request-lint.yml | 10 ++++++++++ .../fw_resource_mongodbatlas_encryption_at_rest.go | 8 ++++---- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 .github/pr-labeler.yml diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 0000000000..5572429197 --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,3 @@ +enhancement: ['feature:*', 'feat:*'] +bug: ['fix:*'] +breaking-change: ['*!*'] \ No newline at end of file diff --git a/.github/workflows/pull-request-lint.yml b/.github/workflows/pull-request-lint.yml index 59f8ec88d3..e11962d58f 100644 --- a/.github/workflows/pull-request-lint.yml +++ b/.github/workflows/pull-request-lint.yml @@ -9,6 +9,16 @@ on: - ready_for_review - edited jobs: + pr-labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: TimonVS/pr-labeler-action@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/pr-labeler.yml validate: name: Validate PR title runs-on: ubuntu-latest diff --git a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go index c2b671368b..0437299568 100644 --- a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go +++ b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go @@ -22,7 +22,6 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/conversion" retrystrategy "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/retry" validators "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/validator" - "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util" matlas "go.mongodb.org/atlas/mongodbatlas" ) @@ -446,9 +445,10 @@ func handleAwsKmsConfigDefaults(ctx context.Context, currentStateFile, newStateF } // Secret access key is not returned by the API response - if len(currentStateFile.AwsKmsConfig) == 1 && util.IsStringPresent(currentStateFile.AwsKmsConfig[0].SecretAccessKey.ValueStringPointer()) { - newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey - } + newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey + // if len(currentStateFile.AwsKmsConfig) == 1 && util.IsStringPresent(currentStateFile.AwsKmsConfig[0].SecretAccessKey.ValueStringPointer()) { + // newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey + // } } func handleAzureKeyVaultConfigDefaults(ctx context.Context, earRSCurrent, earRSNew, earRSConfig *tfEncryptionAtRestRSModel) { From 130b494f3611a25fe4230b9fd7bd7cb490463238 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Fri, 17 Nov 2023 12:07:02 +0000 Subject: [PATCH 2/6] fixes --- .github/pr-labeler.yml | 2 +- .github/workflows/pull-request-lint.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml index 5572429197..ec9a24dd09 100644 --- a/.github/pr-labeler.yml +++ b/.github/pr-labeler.yml @@ -1,3 +1,3 @@ enhancement: ['feature:*', 'feat:*'] bug: ['fix:*'] -breaking-change: ['*!*'] \ No newline at end of file +breaking-change: ['*!*'] diff --git a/.github/workflows/pull-request-lint.yml b/.github/workflows/pull-request-lint.yml index e11962d58f..164d70877d 100644 --- a/.github/workflows/pull-request-lint.yml +++ b/.github/workflows/pull-request-lint.yml @@ -9,11 +9,11 @@ on: - ready_for_review - edited jobs: - pr-labeler: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest + pr-labeler: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - uses: TimonVS/pr-labeler-action@v4 with: From bafd477a778973afaa9302b0e7909e921a9581b2 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Fri, 17 Nov 2023 12:07:58 +0000 Subject: [PATCH 3/6] fixes --- .../fw_resource_mongodbatlas_encryption_at_rest.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go index 0437299568..c1d6d53fc2 100644 --- a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go +++ b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go @@ -9,6 +9,8 @@ import ( "reflect" "time" + "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util" + "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -446,9 +448,9 @@ func handleAwsKmsConfigDefaults(ctx context.Context, currentStateFile, newStateF // Secret access key is not returned by the API response newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey - // if len(currentStateFile.AwsKmsConfig) == 1 && util.IsStringPresent(currentStateFile.AwsKmsConfig[0].SecretAccessKey.ValueStringPointer()) { - // newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey - // } + if len(currentStateFile.AwsKmsConfig) == 1 && util.IsStringPresent(currentStateFile.AwsKmsConfig[0].SecretAccessKey.ValueStringPointer()) { + newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey + } } func handleAzureKeyVaultConfigDefaults(ctx context.Context, earRSCurrent, earRSNew, earRSConfig *tfEncryptionAtRestRSModel) { From 04b509c04bb2c1f9b0bcf9e4264abc6dcd9f788e Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Fri, 17 Nov 2023 12:08:35 +0000 Subject: [PATCH 4/6] fixes --- mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go index c1d6d53fc2..05f1549e79 100644 --- a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go +++ b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go @@ -8,9 +8,7 @@ import ( "net/http" "reflect" "time" - - "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util" - + "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -447,7 +445,6 @@ func handleAwsKmsConfigDefaults(ctx context.Context, currentStateFile, newStateF } // Secret access key is not returned by the API response - newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey if len(currentStateFile.AwsKmsConfig) == 1 && util.IsStringPresent(currentStateFile.AwsKmsConfig[0].SecretAccessKey.ValueStringPointer()) { newStateFile.AwsKmsConfig[0].SecretAccessKey = currentStateFile.AwsKmsConfig[0].SecretAccessKey } From 2a92a41fd595da04c265e3d605224e604cba5664 Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Fri, 17 Nov 2023 12:09:07 +0000 Subject: [PATCH 5/6] fixes --- mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go index 05f1549e79..c2b671368b 100644 --- a/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go +++ b/mongodbatlas/fw_resource_mongodbatlas_encryption_at_rest.go @@ -8,7 +8,7 @@ import ( "net/http" "reflect" "time" - + "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -22,6 +22,7 @@ import ( "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/conversion" retrystrategy "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/retry" validators "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/framework/validator" + "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util" matlas "go.mongodb.org/atlas/mongodbatlas" ) From 0dae65e1263d3f22cddb77c438671f3b63da774f Mon Sep 17 00:00:00 2001 From: andreaangiolillo Date: Fri, 17 Nov 2023 12:11:37 +0000 Subject: [PATCH 6/6] Update pull-request-lint.yml --- .github/workflows/pull-request-lint.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pull-request-lint.yml b/.github/workflows/pull-request-lint.yml index 164d70877d..587cbb2490 100644 --- a/.github/workflows/pull-request-lint.yml +++ b/.github/workflows/pull-request-lint.yml @@ -9,16 +9,6 @@ on: - ready_for_review - edited jobs: - pr-labeler: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - steps: - - uses: TimonVS/pr-labeler-action@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/pr-labeler.yml validate: name: Validate PR title runs-on: ubuntu-latest @@ -67,4 +57,15 @@ jobs: with: header: pr-title-lint-error delete: true - + pr-labeler: + name: Add Label + needs: [ validate ] + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: TimonVS/pr-labeler-action@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/pr-labeler.yml