This Terraform module creates an AWS CloudWatch Logs query definition for saved Insights queries.
See examples/complete for a full working example.
The following commands should be available on your system:
asdformisemakepython3(for pre-commit)
Additionally, your git user and email must be configured. Run the make configure command from the root of the repository to ensure that you meet these requirements.
The .pre-commit-config.yaml file defines pre-commit hooks for Terraform formatting, validation, documentation generation, and detect-secrets. Hooks are installed when you run make configure. Go linting runs via make lint in local development and CI, not via pre-commit.
Post-deploy tests in tests/post_deploy_functional/ and tests/post_deploy_functional_readonly/ target examples/complete via an explicit folder constant in each main_test.go. Adding another example (for example examples/minimal) requires a new test entry point or updating that constant; it is not picked up automatically.
You should validate the changes you make to any module locally, prior to pushing your changes in a branch to GitHub.
- Ensure that you have run
make configuresuccessfully. - Ensure you are signed into the appropriate cloud provider (e.g. AWS) for the module under test in your current console session.
- Run the Terraform and Golang linters:
make lint
- Once linters pass, run integration tests (apply, test, destroy):
make test
The pre-commit validations, as well as the make lint and make test targets, are performed in CI. Running them locally before opening a PR helps ensure a smooth review.
Open a Pull Request to the default (main) branch. The PR title must follow Conventional Commits format to merge and to drive semantic versioning.
Ensure CI workflows pass, address review feedback, and obtain approvals required by CODEOWNERS.
Shared configuration and workflow files are largely managed through launch-terraform-skeleton. Avoid one-off edits to copied skeleton files in this repository unless necessary (for example .gitignore entries for generated artifacts). Use copier check-update / copier update when refreshing from the skeleton.
| Name | Version |
|---|---|
| terraform | ~> 1.10 |
| aws | >= 5.100, < 7.0 |
| Name | Version |
|---|---|
| aws | 6.58.0 |
No modules.
| Name | Type |
|---|---|
| aws_cloudwatch_query_definition.query_definition | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| name | Name of the CloudWatch Logs saved query. | string |
n/a | yes |
| query_string | CloudWatch Logs Insights query string to save. | string |
n/a | yes |
| log_group_names | List of log group names associated with this query definition. | list(string) |
null |
no |
| Name | Description |
|---|---|
| id | The query definition ID. |
| name | The name of the query definition. |
| query_string | The saved query string. |
| log_group_names | Log group names associated with the query definition. |