generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk>
- Loading branch information
Jacob Woffenden
authored
May 1, 2024
1 parent
c1739fd
commit be96f29
Showing
12 changed files
with
164 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "terraform-aws-observability-platform-tenant", | ||
"image": "ghcr.io/ministryofjustice/devcontainer-base:latest", | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}, | ||
"ghcr.io/ministryofjustice/devcontainer-feature/aws:0": {}, | ||
"ghcr.io/ministryofjustice/devcontainer-feature/terraform:0": {} | ||
}, | ||
"postCreateCommand": "bash .devcontainer/post-create.sh", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"EditorConfig.EditorConfig", | ||
"GitHub.vscode-github-actions", | ||
"GitHub.vscode-pull-request-github" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Upgrade Pip | ||
pip install --upgrade pip | ||
|
||
# Install dependencies | ||
pip install --requirement requirements-dev.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 | ||
|
||
- name: Install LocalStack Tools | ||
id: install_localstack_tools | ||
run: | | ||
pip install --requirement requirements-dev.txt | ||
- name: Test | ||
id: test | ||
shell: bash | ||
run: | | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ env/ | |
.vscode | ||
*.code-workspace | ||
*.sha256 | ||
terraform.tfstate | ||
terraform.tfstate* | ||
.terraform.lock.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
test: | ||
docker-compose --file tests/docker-compose-localstack.yml --project-name localstack up --detach | ||
tflocal init | ||
tflocal test -compact-warnings | ||
docker-compose --file tests/docker-compose-localstack.yml --project-name localstack down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
awscli-local==0.22.0 | ||
terraform-local==0.18.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
services: | ||
localstack: | ||
container_name: "localstack" | ||
image: docker.io/localstack/localstack@sha256:b5c082a6d78d49fc4a102841648a8adeab4895f7d9a4ad042d7d485aed2da10d # v3.3.0 | ||
ports: | ||
- "127.0.0.1:4566:4566" # LocalStack Gateway | ||
- "127.0.0.1:4510-4559:4510-4559" # external services port range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* Based on https://docs.localstack.cloud/user-guide/integrations/terraform/#final-configuration */ | ||
provider "aws" { | ||
region = "us-east-1" | ||
access_key = "mock_access_key" | ||
secret_key = "mock_secret_key" | ||
|
||
s3_use_path_style = true | ||
skip_credentials_validation = true | ||
skip_metadata_api_check = true | ||
skip_requesting_account_id = true | ||
|
||
endpoints { | ||
iam = "http://127.0.0.1:4566" | ||
} | ||
} | ||
|
||
variables { | ||
observability_platform_account_id = "111111111111" | ||
} | ||
|
||
run "main" { | ||
command = apply | ||
} | ||
|
||
run "invalid_account_id" { | ||
command = plan | ||
|
||
variables { | ||
observability_platform_account_id = "1234567890" | ||
} | ||
|
||
expect_failures = [var.observability_platform_account_id] | ||
} | ||
|
||
run "invalid_role_name" { | ||
command = plan | ||
|
||
variables { | ||
role_name = "bad-role-name" | ||
} | ||
|
||
expect_failures = [var.role_name] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters