Skip to content

Commit 1ac3d6b

Browse files
committed
Apply linting fixes and update documentation
- Fix Terraform formatting in cloud-run.tf and locals.tf - Remove trailing whitespace from scripts and docs - Add missing newlines at end of files - Update README with app_command variable documentation - Make container command configurable with default ['serve']
1 parent c4021ac commit 1ac3d6b

7 files changed

Lines changed: 20 additions & 9 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,19 @@ No modules.
196196
| [google_sql_database_instance.main](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance) | resource |
197197
| [google_sql_user.main](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_user) | resource |
198198
| [google_vpc_access_connector.main](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vpc_access_connector) | resource |
199+
| [random_id.network_suffix](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
199200
| [random_password.db_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
200201

201202
## Inputs
202203

203204
| Name | Description | Type | Default | Required |
204205
|------|-------------|------|---------|:--------:|
205206
| <a name="input_ai_api_keys"></a> [ai\_api\_keys](#input\_ai\_api\_keys) | Map of AI API keys where key is the environment variable name (e.g., OPENAI\_API\_KEY, ANTHROPIC\_API\_KEY) and value is the actual API key (stored in Secret Manager) | `map(string)` | `{}` | no |
207+
| <a name="input_app_command"></a> [app\_command](#input\_app\_command) | Command to run the container | `list(string)` | <pre>[<br/> "serve"<br/>]</pre> | no |
206208
| <a name="input_app_cpu"></a> [app\_cpu](#input\_app\_cpu) | CPU allocation for the hrafnar application | `string` | `"1000m"` | no |
207209
| <a name="input_app_env_vars"></a> [app\_env\_vars](#input\_app\_env\_vars) | Environment variables for the hrafnar application | `map(string)` | `{}` | no |
208-
| <a name="input_app_image"></a> [app\_image](#input\_app\_image) | Container image for the hrafnar application | `string` | n/a | yes |
210+
| <a name="input_app_image"></a> [app\_image](#input\_app\_image) | Container image for the hrafnar application (without tag) | `string` | n/a | yes |
211+
| <a name="input_app_image_tag"></a> [app\_image\_tag](#input\_app\_image\_tag) | Container image tag | `string` | `"latest"` | no |
209212
| <a name="input_app_max_instances"></a> [app\_max\_instances](#input\_app\_max\_instances) | Maximum number of instances for the hrafnar application | `number` | `10` | no |
210213
| <a name="input_app_memory"></a> [app\_memory](#input\_app\_memory) | Memory allocation for the hrafnar application | `string` | `"512Mi"` | no |
211214
| <a name="input_app_min_instances"></a> [app\_min\_instances](#input\_app\_min\_instances) | Minimum number of instances for the hrafnar application | `number` | `0` | no |
@@ -228,7 +231,7 @@ No modules.
228231
| <a name="input_log_level"></a> [log\_level](#input\_log\_level) | Log level for applications | `string` | `"INFO"` | no |
229232
| <a name="input_mcp_servers"></a> [mcp\_servers](#input\_mcp\_servers) | MCP server configurations | <pre>map(object({<br/> url = string<br/> api_key = optional(string)<br/> description = string<br/> }))</pre> | `{}` | no |
230233
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | Prefix for resource naming | `string` | n/a | yes |
231-
| <a name="input_private_subnet_cidr"></a> [private\_subnet\_cidr](#input\_private\_subnet\_cidr) | CIDR block for the private subnet | `string` | `"10.0.1.0/24"` | no |
234+
| <a name="input_private_subnet_cidr"></a> [private\_subnet\_cidr](#input\_private\_subnet\_cidr) | CIDR block for the private subnet (must be /28 for VPC connector compatibility) | `string` | `"10.0.1.0/28"` | no |
232235
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | The GCP project ID where resources will be created | `string` | n/a | yes |
233236
| <a name="input_region"></a> [region](#input\_region) | The GCP region for resources | `string` | `"us-central1"` | no |
234237
| <a name="input_vpc_cidr"></a> [vpc\_cidr](#input\_vpc\_cidr) | CIDR block for the VPC | `string` | `"10.0.0.0/16"` | no |

cloud-run.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ resource "google_cloud_run_service" "main_app" {
2626
containers {
2727
image = "${var.app_image}:${var.app_image_tag}"
2828

29+
command = var.app_command
30+
2931
ports {
3032
container_port = var.app_port
3133
}

docs/ARTIFACT_REGISTRY_SETUP.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ Update your module configuration:
6464
```hcl
6565
module "hrafnar_deploy" {
6666
source = "../.."
67-
67+
6868
project_id = "your-project-id"
6969
name_prefix = "my-app"
7070
app_image = "us-central1-docker.pkg.dev/your-project-id/quay-remote/reiemp/hrafnar"
7171
app_image_tag = "latest"
72-
72+
7373
# ... other configuration
7474
}
7575
```
@@ -111,4 +111,4 @@ If the quay.io repository requires authentication:
111111
### Performance
112112
- First pull will be slower as it fetches from quay.io
113113
- Subsequent pulls use the cached version in Artifact Registry
114-
- Configure cleanup policies to manage storage costs
114+
- Configure cleanup policies to manage storage costs

examples/dev/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,4 @@ module "hrafnar_gcp_deploy" {
123123
| <a name="output_database_connection_name"></a> [database\_connection\_name](#output\_database\_connection\_name) | Development database connection name |
124124
| <a name="output_hrafnar_app_url"></a> [hrafnar\_app\_url](#output\_hrafnar\_app\_url) | URL of the hrafnar application in development |
125125
| <a name="output_vpc_name"></a> [vpc\_name](#output\_vpc\_name) | Development VPC network name |
126-
<!-- END_TF_DOCS -->
126+
<!-- END_TF_DOCS -->

locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ locals {
3535
router_name = "${local.resource_prefix}-router-${random_id.network_suffix.hex}"
3636
# VPC connector name must be <= 25 chars and match ^[a-z][-a-z0-9]{0,23}[a-z0-9]$
3737
# Add random suffix to avoid naming collisions
38-
vpc_connector_name = length("${local.resource_prefix}-conn-${random_id.network_suffix.hex}") <= 25 ? "${local.resource_prefix}-conn-${random_id.network_suffix.hex}" : "${substr(local.resource_prefix, 0, 11)}-conn-${random_id.network_suffix.hex}"
38+
vpc_connector_name = length("${local.resource_prefix}-conn-${random_id.network_suffix.hex}") <= 25 ? "${local.resource_prefix}-conn-${random_id.network_suffix.hex}" : "${substr(local.resource_prefix, 0, 11)}-conn-${random_id.network_suffix.hex}"
3939

4040
# Cloud Run service names
4141
main_app_service_name = "${local.resource_prefix}-app"

scripts/setup-artifact-registry.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ else
3737
--description="Remote repository for quay.io images" \
3838
--remote-docker-repo=https://quay.io \
3939
--project="$PROJECT_ID"
40-
40+
4141
echo "Repository created successfully!"
4242
fi
4343

@@ -50,4 +50,4 @@ echo " New: ${REGION}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_ID}/reiemp
5050
echo ""
5151
echo "Example in Terraform:"
5252
echo " app_image = \"${REGION}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_ID}/reiemp/hrafnar\""
53-
echo " app_image_tag = \"latest\""
53+
echo " app_image_tag = \"latest\""

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ variable "app_port" {
9999
default = 8080
100100
}
101101

102+
variable "app_command" {
103+
description = "Command to run the container"
104+
type = list(string)
105+
default = ["serve"]
106+
}
107+
102108
variable "app_cpu" {
103109
description = "CPU allocation for the hrafnar application"
104110
type = string

0 commit comments

Comments
 (0)