Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disable default api gateway endpoint for workflows api #247

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}