diff --git a/api.tf b/api.tf new file mode 100644 index 0000000..7fe5c67 --- /dev/null +++ b/api.tf @@ -0,0 +1,40 @@ +resource "aws_apigatewayv2_api" "main" { + name = "sondehub-v2" + disable_execute_api_endpoint = true + api_key_selection_expression = "$request.header.x-api-key" + protocol_type = "HTTP" + route_selection_expression = "$request.method $request.path" + + cors_configuration { + allow_credentials = false + allow_headers = [ + "*", + ] + allow_methods = [ + "*", + ] + allow_origins = [ + "*", + ] + expose_headers = [] + max_age = 0 + } + +} + +resource "aws_apigatewayv2_stage" "default" { + name = "$default" + api_id = aws_apigatewayv2_api.main.id + default_route_settings { + detailed_metrics_enabled = false + } + auto_deploy = true + lifecycle { + ignore_changes = [deployment_id] + } +} + +resource "aws_iam_service_linked_role" "IAMServiceLinkedRole3" { + aws_service_name = "ops.apigateway.amazonaws.com" + description = "The Service Linked Role is used by Amazon API Gateway." +} \ No newline at end of file diff --git a/es.tf b/es.tf new file mode 100644 index 0000000..73b6cc0 --- /dev/null +++ b/es.tf @@ -0,0 +1,285 @@ + + +resource "aws_elasticsearch_domain" "ElasticsearchDomain" { + domain_name = "sondes-v2" + elasticsearch_version = "OpenSearch_1.0" + cluster_config { + dedicated_master_count = 3 + dedicated_master_enabled = false + dedicated_master_type = "t3.small.elasticsearch" + instance_count = 1 + instance_type = "r5.xlarge.elasticsearch" + zone_awareness_enabled = false + } + cognito_options { + enabled = true + identity_pool_id = aws_cognito_identity_pool.CognitoIdentityPool.id + role_arn = aws_iam_role.IAMRole3.arn + user_pool_id = aws_cognito_user_pool.CognitoUserPool.id + } + + access_policies = <