From 9d9c07d1ebf08ec5fb32feac75c70b2e0dc22486 Mon Sep 17 00:00:00 2001 From: Daphne Gold <daphnegold@navapbc.com> Date: Thu, 9 Jan 2025 15:36:57 -0800 Subject: [PATCH] Use underscores in Terraform file names instead of dashes (#828) ## Ticket Resolves #739 ## Changes - Swapped dashes for underscores in the 2 remaining files that were inconsistent - Added info to style guide ## Testing `find . -type f -name '*.tf' | awk -F/ '{print $NF}' | grep -- '-'` [Platform Test PR](https://github.com/navapbc/platform-test/pull/152) <!-- app - begin PR environment info --> ## Preview environment for app - Service endpoint: http://p-152-app-dev-936383488.us-east-1.elb.amazonaws.com - Deployed commit: dd08a9353c1d11202e5222d52c3c44e8042de11e <!-- app - end PR environment info --> --- .github/workflows/send-system-notification.yml | 2 +- docs/infra/style-guide.md | 6 ++++++ docs/infra/system-notifications.md | 2 +- .../resources/{access-control.tf => access_control.tf} | 0 .../{system-notifications.tf => system_notifications.tf} | 0 5 files changed, 8 insertions(+), 2 deletions(-) rename infra/modules/notifications-email-domain/resources/{access-control.tf => access_control.tf} (100%) rename infra/project-config/{system-notifications.tf => system_notifications.tf} (100%) diff --git a/.github/workflows/send-system-notification.yml b/.github/workflows/send-system-notification.yml index f3f4e6838..f2822e3a9 100644 --- a/.github/workflows/send-system-notification.yml +++ b/.github/workflows/send-system-notification.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: channel: - description: "Name of channel to use. Must be defined in /infra/project-config/system-notifications.tf" + description: "Name of channel to use. Must be defined in /infra/project-config/system_notifications.tf" required: true type: string message: diff --git a/docs/infra/style-guide.md b/docs/infra/style-guide.md index 9ac7d44bd..73a2edcdd 100644 --- a/docs/infra/style-guide.md +++ b/docs/infra/style-guide.md @@ -7,6 +7,7 @@ - [Terraform code style](#terraform-code-style) - [Exceptions and additions to Hashicorp's Terraform style guide](#exceptions-and-additions-to-hashicorps-terraform-style-guide) - [Modules](#modules) + - [File Names](#file-names) - [Variables](#variables) - [.gitignore](#gitignore) - [Integration and unit testing](#integration-and-unit-testing) @@ -28,6 +29,11 @@ Here are some exceptions (and additions) to Hashicorp's Terraform style guide. - [Use shared configuration](/docs/infra/module-dependencies.md) instead of the [tfe_outputs data source](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/outputs) to share state between two state files. - Use underscores instead of dashes in file names and module names. +#### File Names + +- Separate words in filenames with underscores (\_) instead of dashes (-), e.g., main.tf, output_variables.tf. +- Use lowercase letters to avoid case sensitivity issues. + #### Variables - Include additional type information in string variable names to clarify the value being stored. For example, use `access_policy_arn` instead of `access_policy`. Common examples of suffixes include: `_id`, `_arn`, and `_name`. diff --git a/docs/infra/system-notifications.md b/docs/infra/system-notifications.md index 1ba86193e..087d6a970 100644 --- a/docs/infra/system-notifications.md +++ b/docs/infra/system-notifications.md @@ -4,4 +4,4 @@ The project sends notifications as part of CI/CD workflows to notify the team ab ## System notifications configuration -The configuration for system notifications is defined in the application's [project-config module](/infra/project-config/). The [system-notifications.tf](/infra/project-config/system-notifications.tf) file defines one or more notification channels that CI/CD workflows can send notifications to. Each channel can use a different notification type. Currently, Slack is the only supported notification type. +The configuration for system notifications is defined in the application's [project-config module](/infra/project-config/). The [system_notifications.tf](/infra/project-config/system_notifications.tf) file defines one or more notification channels that CI/CD workflows can send notifications to. Each channel can use a different notification type. Currently, Slack is the only supported notification type. diff --git a/infra/modules/notifications-email-domain/resources/access-control.tf b/infra/modules/notifications-email-domain/resources/access_control.tf similarity index 100% rename from infra/modules/notifications-email-domain/resources/access-control.tf rename to infra/modules/notifications-email-domain/resources/access_control.tf diff --git a/infra/project-config/system-notifications.tf b/infra/project-config/system_notifications.tf similarity index 100% rename from infra/project-config/system-notifications.tf rename to infra/project-config/system_notifications.tf