Skip to content

This module creates an AWS Synthetics Canary that can be used to test the availability of a site. You can provide your own script, or you can use the script that ships with this module.

License

Notifications You must be signed in to change notification settings

terraform-trailwatch-modules/terraform-aws-synthetics-canary

Repository files navigation

Terraform Trailwatch Modules

Synthetics Canary

Releases License

About

Set up a CloudWatch Synthetics Canary with ease. Creates all resources required to have a functional Canary in no time.

Features

  • Creates policies, buckets, and the Canary.
  • Configures the bucket with lifecycle polices based on a 30 day data retention policy.

Requirements

Name Version
terraform ~> 1.9
archive ~> 2.0
aws ~> 5.0
local ~> 2.0
null ~> 3.0

Providers

Name Version
archive 2.6.0
aws 5.74.0
null 3.2.3

Modules

No modules.

Resources

Name Type
aws_iam_policy.canary_role_inline_policy resource
aws_iam_role.canary_role resource
aws_iam_role_policy_attachment.canary_role_inline_policy resource
aws_s3_bucket.canary_bucket resource
aws_s3_bucket_lifecycle_configuration.canary_bucket_lifecycle resource
aws_s3_bucket_versioning.canary_bucket_versioning resource
aws_s3_object.canary_script_object resource
aws_synthetics_canary.canary resource
null_resource.cleanup resource
archive_file.lambda data source
aws_iam_policy_document.canary_role_inline_policy data source
aws_iam_policy_document.canary_role_trust_policy data source
aws_region.current data source

Inputs

Name Description Type Default Required
aws_tags Additional tags to apply to this module. map(string) {} no
cwsyn_canary_env The CloudWatch Synthetics Canary environment variables. If using the default Lambda function, specify the URLS as a string-encoded JSON array. map(string)
{
"WEBSITE_URLS": "["google.com"]"
}
no
cwsyn_canary_lambda_handler The handler function to use when invoking the Lambda function. string "lambda.handler" no
cwsyn_canary_lambda_script_location The location of the Lambda Function artifact to use - must be a directory. Leave unspecified to use the Function that ships with this module. string null no
cwsyn_canary_name Name to assign to the Canary. string n/a yes
cwsyn_canary_rate The rate expression to use with the CloudWatch Synthetics Canary. string "rate(1 minute)" no
cwsyn_canary_runtime The runtime to use with this Canary. string "syn-python-selenium-4.1" no

Outputs

No outputs.

Simple Example

module "trailwatch_canary" {
  source = "terraform-trailwatch-modules/synthetics-canary/aws"
  cwsyn_canary_name = "website-monitor"
}

Advanced Example

module "trailwatch_canary" {
  source = "terraform-trailwatch-modules/synthetics-canary/aws"
  cwsyn_canary_name = "website_monitor"
  cwsyn_canary_runtime = "syn-python-selenium-4.0"
  cwsyn_canary_lambda_handler = "lambda.my_function"
  cwsyn_canary_lambda_script_location = "./path/to/directory"
  cwysn_canary_env = {"A_ENV": "B"}
  cwsyN_canary_rate = "rate(5 minutes)"
  ...
}

Changelog

For a detailed list of changes, please refer to the CHANGELOG.md.

License

This module is licensed under the MIT License.

About

This module creates an AWS Synthetics Canary that can be used to test the availability of a site. You can provide your own script, or you can use the script that ships with this module.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published