Skip to content

Commit

Permalink
Merge pull request #247 from NASA-IMPACT/jt/issue-452-disable-default…
Browse files Browse the repository at this point in the history
…-endpoint

feat: disable default api gateway endpoint for workflows api
  • Loading branch information
botanical authored Oct 24, 2024
2 parents b9a9323 + 7af892a commit 61a797d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
21 changes: 3 additions & 18 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ resource "null_resource" "update_workflows_lambda_image" {

# API Gateway HTTP API
resource "aws_apigatewayv2_api" "workflows_http_api" {
name = "${var.prefix}_workflows_http_api"
protocol_type = "HTTP"
name = "${var.prefix}_workflows_http_api"
protocol_type = "HTTP"
disable_execute_api_endpoint = var.disable_default_apigw_endpoint
}

# Lambda Integration for API Gateway
Expand Down Expand Up @@ -305,19 +306,3 @@ resource "aws_lambda_permission" "api-gateway" {
principal = "apigateway.amazonaws.com"
source_arn = "${aws_apigatewayv2_api.workflows_http_api.execution_arn}/*/$default"
}

# Cloudfront update

resource "null_resource" "update_cloudfront" {
triggers = {
always_run = "${timestamp()}"
}

count = coalesce(var.cloudfront_id, false) != false ? 1 : 0

provisioner "local-exec" {
command = "${path.module}/cf_update.sh ${var.cloudfront_id} workflows_api_origin \"${aws_apigatewayv2_api.workflows_http_api.api_endpoint}\""
}

depends_on = [aws_apigatewayv2_api.workflows_http_api]
}
1 change: 0 additions & 1 deletion infrastructure/terraform.tfvars.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ vector_secret_name="${VECTOR_SECRET_NAME}"
vector_security_group="${VECTOR_SECURITY_GROUP}"
vector_vpc="${VECTOR_VPC:-null}"
workflow_root_path="${WORKFLOW_ROOT_PATH}"
cloudfront_id="${VEDA_CLOUDFRONT_ID}"
cognito_domain="${VEDA_COGNITO_DOMAIN}"
client_id="${VEDA_CLIENT_ID}"
userpool_id="${VEDA_USERPOOL_ID}"
9 changes: 5 additions & 4 deletions infrastructure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ variable "workflow_root_path" {
default = "/api/workflows"
}

variable "cloudfront_id" {
type = string
}

variable "cognito_domain" {
type = string
}
Expand Down Expand Up @@ -134,3 +130,8 @@ variable "ecs_task_memory" {
type = number
default = 4096
}

variable "disable_default_apigw_endpoint" {
type = bool
default = false
}

0 comments on commit 61a797d

Please sign in to comment.