diff --git a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/main.tf b/terraform-k8s-infrastructure/modules/k8s_microservice_routing/main.tf index c018d1b..e06c951 100644 --- a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/main.tf +++ b/terraform-k8s-infrastructure/modules/k8s_microservice_routing/main.tf @@ -263,7 +263,6 @@ resource "aws_api_gateway_deployment" "prod" { jsonencode(module.gfw-guira.endpoints), jsonencode(module.gfw-forma.endpoints), jsonencode(module.gfw-ogr.endpoints), - jsonencode(module.gfw-ogr-gfw-pro.endpoints), jsonencode(module.gfw-prodes.endpoints), jsonencode(module.gfw-umd.endpoints), jsonencode(module.gfw-user.endpoints), @@ -971,23 +970,6 @@ module "gfw-ogr" { ] } -module "gfw-ogr-gfw-pro" { - source = "./microservices/gfw-ogr-gfw-pro" - api_gateway = aws_api_gateway_rest_api.rw_api_gateway - cluster_ca = var.cluster_ca - cluster_endpoint = var.cluster_endpoint - cluster_name = var.cluster_name - x_rw_domain = var.x_rw_domain - vpc = var.vpc - vpc_link = aws_api_gateway_vpc_link.rw_api_apps_lb_vpc_link - v1_resource = module.v1_resource.aws_api_gateway_resource - connection_type = "VPC_LINK" - require_api_key = var.require_api_key - - eks_asg_names = [ - data.aws_autoscaling_groups.gfw_autoscaling_group.names.0 - ] -} module "gfw-prodes" { source = "./microservices/gfw-prodes" diff --git a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/main.tf b/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/main.tf deleted file mode 100644 index c36b843..0000000 --- a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/main.tf +++ /dev/null @@ -1,93 +0,0 @@ -resource "kubernetes_service" "gfw_ogr_gfw_pro_service" { - count = var.connection_type == "VPC_LINK" ? 1 : 0 - - metadata { - name = "gfw-ogr-gfw-pro" - namespace = "default" - } - spec { - selector = { - name = "gfw-ogr-gfw-pro" - } - port { - port = 30568 - node_port = 30568 - target_port = 3200 - } - - type = "NodePort" - } -} - -locals { - api_gateway_target_url = var.connection_type == "VPC_LINK" ? data.aws_lb.load_balancer[0].dns_name : var.target_url -} - -data "aws_lb" "load_balancer" { - count = var.connection_type == "VPC_LINK" ? 1 : 0 - - arn = var.vpc_link.target_arns[0] -} - -resource "aws_lb_listener" "gfw_ogr_gfw_pro_nlb_listener" { - count = var.connection_type == "VPC_LINK" ? 1 : 0 - - load_balancer_arn = data.aws_lb.load_balancer[0].arn - port = 30568 - protocol = "TCP" - - default_action { - type = "forward" - target_group_arn = aws_lb_target_group.gfw_ogr_gfw_pro_lb_target_group[0].arn - } -} - -resource "aws_lb_target_group" "gfw_ogr_gfw_pro_lb_target_group" { - count = var.connection_type == "VPC_LINK" ? 1 : 0 - - name = "gfw-ogr-gfw-pro-lb-tg" - port = 30568 - protocol = "TCP" - target_type = "instance" - vpc_id = var.vpc.id - - health_check { - enabled = true - protocol = "TCP" - } -} - -resource "aws_autoscaling_attachment" "asg_attachment_gfw_ogr_gfw_pro" { - count = var.connection_type == "VPC_LINK" ? length(var.eks_asg_names) : 0 - - autoscaling_group_name = var.eks_asg_names[count.index] - lb_target_group_arn = aws_lb_target_group.gfw_ogr_gfw_pro_lb_target_group[0].arn -} - -// /v1/gfw-pro -module "v1_gfw_pro_resource" { - source = "../resource" - rest_api_id = var.api_gateway.id - parent_id = var.v1_resource.id - path_part = "gfw-pro" -} - -// /v1/gfw-pro/{proxy+} -module "v1_gfw_pro_proxy_resource" { - source = "../resource" - rest_api_id = var.api_gateway.id - parent_id = module.v1_gfw_pro_resource.aws_api_gateway_resource.id - path_part = "{proxy+}" -} - -module "gfw_ogr_any_v1_gfw_pro_proxy" { - source = "../../endpoint" - x_rw_domain = var.x_rw_domain - api_gateway = var.api_gateway - api_resource = module.v1_gfw_pro_proxy_resource.aws_api_gateway_resource - method = "ANY" - uri = "http://${local.api_gateway_target_url}:30568/api/v1/{proxy}" - vpc_link = var.vpc_link - connection_type = var.connection_type - require_api_key = var.require_api_key -} diff --git a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/outputs.tf b/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/outputs.tf deleted file mode 100644 index 5efad9e..0000000 --- a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/outputs.tf +++ /dev/null @@ -1,5 +0,0 @@ -output "endpoints" { - value = [ - module.gfw_ogr_any_v1_gfw_pro_proxy.endpoint_gateway_integration - ] -} \ No newline at end of file diff --git a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/variables.tf b/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/variables.tf deleted file mode 100644 index 418be44..0000000 --- a/terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro/variables.tf +++ /dev/null @@ -1,76 +0,0 @@ -variable "cluster_endpoint" { - type = string - description = "The k8s cluster endpoint. Must be accessible from localhost" - default = null -} - -variable "cluster_ca" { - type = string - description = "The k8s CA string" - default = null -} - -variable "cluster_name" { - type = string - description = "The k8s cluster name" - default = null -} - -variable "x_rw_domain" { - type = string - description = "Value to be passed as the x-rw-domain header" -} - -variable "api_gateway" { - type = object({ - id = string - root_resource_id = string - }) - description = "Instance of aws_api_gateway_rest_api" -} - -variable "vpc" { - type = object({ - id = string - cidr_block = string - }) - description = "The id of the VPC" - default = null -} - -variable "vpc_link" { - type = object({ - id = string - target_arns = list(string) - }) - description = "VPC Link to the LB" - default = { id : null, target_arns : [] } -} - -variable "require_api_key" { - type = bool - default = false -} - -variable "connection_type" { - type = string - description = "API Gateway integration type" -} - -variable "eks_asg_names" { - type = list(any) - description = "List of the EKS ASG names" - default = [] -} - -variable "target_url" { - type = string - description = "Target URL" - default = null -} - -variable "v1_resource" { - type = object({ - id = string - }) -} diff --git a/terraform-localstack/main.tf b/terraform-localstack/main.tf index 15a52db..c70a797 100644 --- a/terraform-localstack/main.tf +++ b/terraform-localstack/main.tf @@ -80,7 +80,6 @@ resource "aws_api_gateway_deployment" "prod" { jsonencode(module.gfw-guira.endpoints), jsonencode(module.gfw-forma.endpoints), jsonencode(module.gfw-ogr.endpoints), - jsonencode(module.gfw-ogr-gfw-pro.endpoints), jsonencode(module.gfw-prodes.endpoints), jsonencode(module.gfw-umd.endpoints), jsonencode(module.gfw-user.endpoints), @@ -465,15 +464,6 @@ module "gfw-ogr" { v2_resource = module.v2_resource.aws_api_gateway_resource } -module "gfw-ogr-gfw-pro" { - source = "../terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-ogr-gfw-pro" - api_gateway = aws_api_gateway_rest_api.rw_api_gateway - x_rw_domain = var.x_rw_domain - v1_resource = module.v1_resource.aws_api_gateway_resource - connection_type = "INTERNET" - target_url = var.microservice_host -} - module "gfw-prodes" { source = "../terraform-k8s-infrastructure/modules/k8s_microservice_routing/microservices/gfw-prodes" api_gateway = aws_api_gateway_rest_api.rw_api_gateway