Skip to content

Commit

Permalink
fix the get credential scheduled configuration. wip on terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas loubrieu committed Jul 10, 2024
1 parent 0a2bfb3 commit bdbec83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
Expand All @@ -17,6 +18,7 @@

@SpringBootApplication
@OpenAPIDefinition
@EnableScheduling
@ComponentScan(basePackages = {"gov.nasa.pds.api.registry.configuration",
"gov.nasa.pds.api.registry.controllers", "gov.nasa.pds.api.registry.model",
"gov.nasa.pds.api.registry.search", "javax.servlet.http"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import org.springframework.scheduling.annotation.Scheduled;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -55,8 +54,7 @@ public String getExpiration() {
}


@Configuration
@EnableScheduling
@Component
public class AWSCredentialsFetcher {

private static final Logger log = LoggerFactory.getLogger(AWSCredentialsFetcher.class);
Expand Down Expand Up @@ -86,6 +84,7 @@ public void fetchCredentials() {
awsCredProperties.setProperty("aws.secretAccessKey", awsCredentials.getSecretAccessKey());
awsCredProperties.setProperty("aws.sessionToken", awsCredentials.getToken());
System.setProperties(awsCredProperties);
log.info("Expiration of the AWS token is scheduled in " + awsCredentials.expiration);
} catch (IOException e) {
log.error("Unable to get or renew AWS Credentials", e);
}
Expand Down
4 changes: 2 additions & 2 deletions terraform/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ EOF

resource "aws_lb" "registry-api-lb" {
name = "registry-api-lb-new"
internal = true
internal = false
load_balancer_type = "application"
security_groups = var.aws_fg_security_groups
subnets = var.aws_fg_subnets

enable_deletion_protection = true
enable_deletion_protection = false

access_logs {
bucket = var.aws_s3_bucket_logs_id
Expand Down

0 comments on commit bdbec83

Please sign in to comment.