From e30c9863d034fb8b7908ce566dab2a08a276215d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfredo=20Espa=C3=B1a?= Date: Wed, 23 Oct 2024 15:35:42 -0600 Subject: [PATCH] fix: Sonar cloud issues (#1453) --- .../storage/configuration/StorageTypeAutoConfiguration.java | 2 +- .../configuration/TerraformOutputAutoConfiguration.java | 2 +- .../tfstate/configuration/TerraformStateAutoConfiguration.java | 2 +- .../plugin/storage/configuration/StorageAutoConfiguration.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/terrakube/api/plugin/storage/configuration/StorageTypeAutoConfiguration.java b/api/src/main/java/org/terrakube/api/plugin/storage/configuration/StorageTypeAutoConfiguration.java index 775b8eff4..0c3434881 100644 --- a/api/src/main/java/org/terrakube/api/plugin/storage/configuration/StorageTypeAutoConfiguration.java +++ b/api/src/main/java/org/terrakube/api/plugin/storage/configuration/StorageTypeAutoConfiguration.java @@ -64,7 +64,7 @@ public StorageTypeService terraformOutput(StreamingService streamingService, Sto break; case AWS: S3Client s3client; - if (awsStorageTypeProperties.getEndpoint() != "") { + if (awsStorageTypeProperties.getEndpoint() != null && !awsStorageTypeProperties.getEndpoint().isEmpty()) { log.info("Creating AWS SDK with custom endpoint and custom credentials"); s3client = S3Client.builder() .region(Region.AWS_GLOBAL) diff --git a/executor/src/main/java/org/terrakube/executor/plugin/tfoutput/configuration/TerraformOutputAutoConfiguration.java b/executor/src/main/java/org/terrakube/executor/plugin/tfoutput/configuration/TerraformOutputAutoConfiguration.java index 07aa35c62..441faf4b3 100644 --- a/executor/src/main/java/org/terrakube/executor/plugin/tfoutput/configuration/TerraformOutputAutoConfiguration.java +++ b/executor/src/main/java/org/terrakube/executor/plugin/tfoutput/configuration/TerraformOutputAutoConfiguration.java @@ -66,7 +66,7 @@ public TerraformOutput terraformOutput(TerraformOutputProperties terraformOutput break; case AwsTerraformOutputImpl: S3Client s3client = null; - if (awsTerraformOutputProperties.getEndpoint() != "") { + if (awsTerraformOutputProperties.getEndpoint() != null && !awsTerraformOutputProperties.getEndpoint().isEmpty()) { log.info("Creating AWS SDK with custom endpoint and custom credentials"); s3client = S3Client.builder() .region(Region.AWS_GLOBAL) diff --git a/executor/src/main/java/org/terrakube/executor/plugin/tfstate/configuration/TerraformStateAutoConfiguration.java b/executor/src/main/java/org/terrakube/executor/plugin/tfstate/configuration/TerraformStateAutoConfiguration.java index 1acdfa0c5..414c55fa8 100644 --- a/executor/src/main/java/org/terrakube/executor/plugin/tfstate/configuration/TerraformStateAutoConfiguration.java +++ b/executor/src/main/java/org/terrakube/executor/plugin/tfstate/configuration/TerraformStateAutoConfiguration.java @@ -76,7 +76,7 @@ public TerraformState terraformState(TerrakubeClient terrakubeClient, TerraformS case AwsTerraformStateImpl: S3Client s3client = null; - if (awsTerraformStateProperties.getEndpoint() != "") { + if (awsTerraformStateProperties.getEndpoint() != null && !awsTerraformStateProperties.getEndpoint().isEmpty()) { log.info("Creating AWS with custom endpoint and custom credentials"); s3client = S3Client.builder() .credentialsProvider(StaticCredentialsProvider.create(getAwsBasicCredentials(awsTerraformStateProperties))) diff --git a/registry/src/main/java/org/terrakube/registry/plugin/storage/configuration/StorageAutoConfiguration.java b/registry/src/main/java/org/terrakube/registry/plugin/storage/configuration/StorageAutoConfiguration.java index 3fe716d6d..764bd2c73 100644 --- a/registry/src/main/java/org/terrakube/registry/plugin/storage/configuration/StorageAutoConfiguration.java +++ b/registry/src/main/java/org/terrakube/registry/plugin/storage/configuration/StorageAutoConfiguration.java @@ -72,7 +72,7 @@ public StorageService terraformOutput(OpenRegistryProperties openRegistryPropert break; case AwsStorageImpl: S3Client s3client; - if (awsStorageServiceProperties.getEndpoint() != "") { + if (awsStorageServiceProperties.getEndpoint() != null && !awsStorageServiceProperties.getEndpoint().isEmpty()) { log.info("Creating AWS SDK with custom endpoint and custom credentials"); s3client = S3Client.builder() .region(Region.AWS_GLOBAL)