这是indexloc提供的服务,不要输入任何密码
Skip to content

JamesWoolfenden/terraform-aws-aurora

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-aurora

Build Status Latest Release GitHub tag (latest SemVer) Terraform Version Infrastructure Tests pre-commit checkov Infrastructure Tests

Terraform module - creates Aurpora cluster and instances


It's 100% Open Source and licensed under the APACHE2.

Usage

This is just a basic illustration of the resources.

Include this repository as a module in your existing terraform code:

module "aurora" {
  source          = "JamesWoolfenden/aurora/aws"
  version         = "0.0.2"
  common_tags     = var.common_tags
  instances       = var.instances
  cluster         = var.cluster
}

Costs

Using the example.

Monthly cost estimate

Project: .

 Name                                                       Monthly Qty  Unit                    Monthly Cost

 aws_kms_key.aurora
 ├─ Customer master key                                               1  months                         $1.00
 ├─ Requests                                          Monthly cost depends on usage: $0.03 per 10k requests
 ├─ ECC GenerateDataKeyPair requests                  Monthly cost depends on usage: $0.10 per 10k requests
 └─ RSA GenerateDataKeyPair requests                  Monthly cost depends on usage: $0.10 per 10k requests

 module.aurora.aws_rds_cluster.default
 ├─ Storage                                                           0  GB                             $0.00
 └─ I/O rate                                                          0  1M requests                    $0.00

 module.aurora.aws_rds_cluster_instance.instances[0]
 └─ Database instance (on-demand, db.r4.large)                      730  hours                        $248.20

 module.aurora.aws_rds_cluster_instance.instances[1]
 └─ Database instance (on-demand, db.r4.large)                      730  hours                        $248.20

 PROJECT TOTAL                                                                                        $497.40

IAM Permissions

{}

IAC comparison

The makefile in the example runs 4 of the main IAC SAST tools:

  • Checkov
  • TFSec
  • Terrascan
  • Kics

You can run these as part of the validate scripts contained here and all 4 will output to the output folder.

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

No modules.

Resources

Name Type
aws_rds_cluster.default resource
aws_rds_cluster_instance.instances resource
aws_rds_cluster_parameter_group.examplea resource
aws_availability_zones.zones data source

Inputs

Name Description Type Default Required
availability_zone n/a string "" no
backup_retention_period Schedule your Backup retention and enable number 35 no
cluster All the properties of an Aurora Cluster map(any) n/a yes
common_tags This is to help you add tags to your cloud objects map(any) n/a yes
deletion_protection n/a bool true no
enabled_cloudwatch_logs_exports Set of log types to export to cloudwatch. If omitted, no logs will be exported list(any)
[
"audit"
]
no
engine n/a string "aurora" no
engine_version n/a string "5.7.mysql_aurora.2.03.2" no
iam_database_authentication_enabled Use IAM bool true no
instances Settings of you database instances any n/a yes
kms_key_id n/a string n/a yes
master_password n/a string n/a yes
monitoring_interval The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance string 1 no
monitoring_role_arn n/a string "" no
preferred_backup_window n/a string "04:00-09:00" no
promotion_tier Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoted to writer number 0 no

Outputs

Name Description
cluster n/a
instances n/a

Policy

The Terraform resource required is:

resource "aws_iam_policy" "terraform_pike" {
  name_prefix = "terraform_pike"
  path        = "/"
  description = "Pike Autogenerated policy from IAC"

  policy = jsonencode({
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeAvailabilityZones"
            ],
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor2",
            "Effect": "Allow",
            "Action": [
                "rds:AddTagsToResource",
                "rds:CreateDBCluster",
                "rds:CreateDBClusterParameterGroup",
                "rds:CreateDBInstance",
                "rds:DeleteDBCluster",
                "rds:DeleteDBClusterParameterGroup",
                "rds:DescribeDBClusterParameterGroups",
                "rds:DescribeDBClusterParameters",
                "rds:DescribeDBClusters",
                "rds:DescribeDBInstances",
                "rds:DescribeGlobalClusters",
                "rds:ListTagsForResource",
                "rds:ModifyDBCluster",
                "rds:ModifyDBClusterParameterGroup",
                "rds:ModifyDBInstance",
                "rds:RemoveTagsFromResource"
            ],
            "Resource": "*"
        }
    ]
})
}

Related Projects

Check out these related projects.

Help

Got a question?

File a GitHub issue.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Copyrights

Copyright © 2019-2022 James Woolfenden

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors

James Woolfenden
James Woolfenden