farhanangullia / terraform-aws-scheduled-switch

Spin up and down your Terraform resources on schedule!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scheduled switch for Terraform managed resources on AWS

This module allows you to apply a pattern of scheduled EventBridge events to manage your Terraform resources. It could be used to simply create, update or destroy resources on schedule. An example where this pattern could be applied to is when you have Terraform managed resources that are incurring costs during unutilized periods of time. Such a solution to spin resources up and down on schedule could help with significant cost savings.

Examples

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Usage

Requirements

Name Version
terraform >= 0.15.0
aws >= 3.73.0
random >= 3.0

Providers

Name Version
aws >= 3.73.0
random >= 3.0

Modules

No modules.

Resources

Name Type
aws_codebuild_project.switch_codebuild_project resource
aws_codebuild_source_credential.git_credentials resource
aws_iam_policy.codebuild_policy resource
aws_iam_role.codebuild_role resource
aws_iam_role.switch_codebuild_role resource
aws_iam_role_policy.switch_codebuild_s3_backend_policy resource
aws_iam_role_policy.switch_codebuild_ssm_policy resource
aws_iam_role_policy_attachment.codebuild_attachment resource
aws_iam_role_policy_attachment.s3_policy resource
aws_iam_role_policy_attachment.switch_additional_policy resource
aws_scheduler_schedule.kill_schedule resource
aws_scheduler_schedule.revive_schedule resource
aws_ssm_parameter.tf_init_parameter resource
aws_ssm_parameter.tf_kill_parameter resource
aws_ssm_parameter.tf_revive_parameter resource
aws_ssm_parameter.tf_version_parameter resource
random_string.random resource
aws_caller_identity.current data source
aws_iam_policy_document.codebuild_policy data source
aws_iam_policy_document.codebuild_trust data source
aws_partition.current data source

Inputs

Name Description Type Default Required
init_command Terraform command used to initialize working directory. string n/a yes
kill_command Terraform command to destroy the target resources. string n/a yes
kill_resources_schedule Schedule expression in the form of cron or rate expressions. Refer to https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html for more details. string n/a yes
revive_command Terraform command to revive/recreate the target resources. string n/a yes
revive_resources_schedule Schedule expression in the form of cron or rate expressions. Refer to https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html for more details. string n/a yes
source_location Information about the location of the source code of the Terraform configuration that is being managed. string n/a yes
source_type The type of repository that contains the source code to be built. string n/a yes
terraform_version Version of Terraform. string n/a yes
tf_backend_bucket S3 Backend bucket name string n/a yes
tf_backend_key S3 object key to terraform state file string n/a yes
git_personal_access_token For GitHub or GitHub Enterprise, this is the personal access token. string null no
kill_schedule_state Whether the schedule should be enabled or disabled. string "ENABLED" no
revive_schedule_state Whether the schedule should be enabled or disabled. string "ENABLED" no
schedule_timezone Timezone in which the scheduling expression is evaluated. string "UTC" no
switch_additional_policy_arn ARN of additional IAM policy for CodeBuild. string null no

Outputs

No outputs.

About

Spin up and down your Terraform resources on schedule!

License:MIT No Attribution


Languages

Language:HCL 86.2%Language:Go 13.8%