-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(aws): Add default test for aws
- Loading branch information
1 parent
8f0f581
commit fec1eb1
Showing
1 changed file
with
53 additions
and
0 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,53 @@ | ||
# --------------- | ||
# Mock providers | ||
# --------------- | ||
mock_provider "aws" { | ||
# This is used because the mocked data is a random string instead of JSON, causing downstream dependencies to fail. | ||
# This block overrides the "json" output of ALL aws_iam_policy_document data blocks to use a JSON encoded string. | ||
mock_data "aws_iam_policy_document" { | ||
defaults = { | ||
json = "{\"some_fake\":\"json\"}" | ||
} | ||
} | ||
# This is used to return valid zone names for the us-west-2 zone instead of the random strings that Terraform will | ||
# generate for mocked tests. Not using this will cause the data block to create an empty list of strings. | ||
mock_data "aws_availability_zones" { | ||
defaults = { | ||
names = ["us-west-2a", "us-west-2b", "us-west-2c", "us-west-2d"] | ||
} | ||
} | ||
} | ||
|
||
# A mocked databricks provider is added here so that the alias requirement can be met | ||
mock_provider "databricks" { | ||
alias = "mws" | ||
} | ||
# --------------- | ||
|
||
# --------------- | ||
# Variables | ||
# --------------- | ||
# The variables block below provides variable values for the SRA module directly, NOT the configuration that is found in | ||
# this directory (aws-gov/tf). This is because the module call in sra.tf contains values that must be overwritten by the | ||
# user of SRA. Calling the module directly allows us to provide these values as variables instead. | ||
# | ||
# Note that the below values were generated by AI, and are not real values. | ||
|
||
variables { | ||
aws_account_id = "123456789012" | ||
client_id = "your-client-id" | ||
client_secret = "your-client-secret" | ||
databricks_account_id = "databricks-account-id" | ||
region = "us-west-2" | ||
resource_prefix = "my-resource-prefix" | ||
admin_user = "[email protected]" | ||
} | ||
|
||
# --------------- | ||
# Tests | ||
# --------------- | ||
# This runs a plan command on the module directly | ||
run "plan_test" { | ||
command = plan | ||
} | ||
# --------------- |