Skip to content

Commit

Permalink
add eudr credentials k8s secret and eudr dataset api env var
Browse files Browse the repository at this point in the history
(cherry picked from commit 8d4f44c)
  • Loading branch information
alexeh committed Mar 27, 2024
1 parent 346d8ff commit 1219d30
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions infrastructure/kubernetes/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module "aws_environment" {
allowed_account_id = var.allowed_account_id
gmaps_api_key = var.gmaps_api_key
sendgrid_api_key = var.sendgrid_api_key
eudr_credentials = jsonencode(var.eudr_credentials)
load_fresh_data = lookup(each.value, "load_fresh_data", false)
data_import_arguments = lookup(each.value, "data_import_arguments", ["seed-data"])
image_tag = lookup(each.value, "image_tag", each.key)
Expand Down
16 changes: 12 additions & 4 deletions infrastructure/kubernetes/modules/aws/env/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ locals {
name = "REQUIRE_USER_ACCOUNT_ACTIVATION"
value = "true"
},
{
name = "USE_NEW_METHODOLOGY"
value = "true"
},
{
name = "FILE_SIZE_LIMIT"
value = 31457280
},
{
name = "EUDR_DATASET"
value = "cartobq.eudr.mock_data_optimized"
}
] : env.name => env.value
}
Expand Down Expand Up @@ -136,8 +136,14 @@ module "k8s_api" {
name = "SENDGRID_API_KEY"
secret_name = "api"
secret_key = "SENDGRID_API_KEY"
},
{
name = "EUDR_CREDENTIALS"
secret_name = "api"
secret_key = "EUDR_CREDENTIALS"
}


])

env_vars = local.api_env_vars
Expand Down Expand Up @@ -260,6 +266,7 @@ module "k8s_data_import" {
]
}


module "k8s_secrets" {
source = "../secrets"
tf_state_bucket = var.tf_state_bucket
Expand All @@ -268,6 +275,7 @@ module "k8s_secrets" {
namespace = var.environment
gmaps_api_key = var.gmaps_api_key
sendgrid_api_key = var.sendgrid_api_key
eudr_credentials = var.eudr_credentials

depends_on = [
module.k8s_namespace
Expand Down
6 changes: 6 additions & 0 deletions infrastructure/kubernetes/modules/aws/env/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ variable "sendgrid_api_key" {
description = "The Sendgrid API key used for sending emails"
}

variable "eudr_credentials" {
type = string
sensitive = true
description = "Service Account credentials to access EUDR Data"
}

variable "load_fresh_data" {
type = bool
default = false
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/kubernetes/modules/aws/secrets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ locals {
jwt_password_reset_secret = random_password.jwt_password_reset_secret_generator.result
gmaps_api_key = var.gmaps_api_key
sendgrid_api_key = var.sendgrid_api_key
eudr_credentials = var.eudr_credentials
}
}

Expand Down Expand Up @@ -52,6 +53,7 @@ resource "kubernetes_secret" "api_secret" {
JWT_PASSWORD_RESET_SECRET = local.api_secret_json.jwt_password_reset_secret
GMAPS_API_KEY = local.api_secret_json.gmaps_api_key
SENDGRID_API_KEY = local.api_secret_json.sendgrid_api_key
EUDR_CREDENTIALS = local.api_secret_json.eudr_credentials
}
}

Expand Down
6 changes: 6 additions & 0 deletions infrastructure/kubernetes/modules/aws/secrets/variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ variable "sendgrid_api_key" {
sensitive = true
description = "The SendGrid API key used for sending emails"
}

variable "eudr_credentials" {
type = string
sensitive = true
description = "Service Account credentials to access EUDR Data"
}
18 changes: 18 additions & 0 deletions infrastructure/kubernetes/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ variable "sendgrid_api_key" {
description = "The Sendgrid API key used for sending emails"
}

variable "eudr_credentials" {
type = object({
type = string
project_id = string
private_key = string
private_key_id = string
client_email = string
client_id = string
auth_uri = string
client_x509_cert_url = string
token_uri = string
auth_provider_x509_cert_url = string
universe_domain = string
})
sensitive = true
description = "Service Account credentials to access EUDR Data"
}

variable "repo_name" {
type = string
description = "Name of the github repo where the project is hosted"
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/kubernetes/vars/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ gcp_project_id = "landgriffon"
gmaps_api_key = ""
mapbox_api_token = ""
sendgrid_api_key = ""
eudr_credentials = {}


0 comments on commit 1219d30

Please sign in to comment.