|
1 |
| -[](https://choosealicense.com/licenses/unlicense/)[](https://github.com/kunduso/amazon-elasticache-redis-tf/pulls?q=is%3Apr+is%3Aclosed)[](https://GitHub.com/kunduso/amazon-elasticache-redis-tf/pull/) |
2 |
| -[](https://github.com/kunduso/amazon-elasticache-redis-tf/issues?q=is%3Aissue+is%3Aclosed)[](https://GitHub.com/kunduso/amazon-elasticache-redis-tf/issues/) |
3 |
| -[](https://github.com/kunduso/amazon-elasticache-redis-tf/actions/workflows/terraform.yml)[](https://github.com/kunduso/amazon-elasticache-redis-tf/actions/workflows/code-scan.yml) |
| 1 | +[](https://choosealicense.com/licenses/unlicense/) [](https://github.com/kunduso/amazon-elasticache-redis-tf/pulls?q=is%3Apr+is%3Aclosed) [](https://GitHub.com/kunduso/amazon-elasticache-redis-tf/pull/) |
| 2 | +[](https://github.com/kunduso/amazon-elasticache-redis-tf/issues?q=is%3Aissue+is%3Aclosed) [](https://GitHub.com/kunduso/amazon-elasticache-redis-tf/issues/) |
| 3 | +[](https://github.com/kunduso/amazon-elasticache-redis-tf/actions/workflows/terraform.yml) [](https://github.com/kunduso/amazon-elasticache-redis-tf/actions/workflows/code-scan.yml) [](https://github.com/kunduso/amazon-elasticache-redis-tf/actions/workflows/documentation.yml) |
4 | 4 |
|
5 | 5 |
|
6 | 6 | 
|
@@ -28,10 +28,88 @@ For this code to function without errors, I created an **OpenID connect** identi
|
28 | 28 | <br />I stored the ARN of the IAM Role as a GitHub secret which is referred in the [`terraform.yml`](https://github.com/kunduso/amazon-elasticache-redis-tf/blob/eb148db2b9ff37cff9f1fb469d0c14b6479bd57a/.github/workflows/terraform.yml#L42) file.
|
29 | 29 | <br />Since I used Infracost in this repository, I stored the `INFRACOST_API_KEY` as a repository secret. It is referenced in the [`terraform.yml`](https://github.com/kunduso/amazon-elasticache-redis-tf/blob/eb148db2b9ff37cff9f1fb469d0c14b6479bd57a/.github/workflows/terraform.yml#L52) GitHub actions workflow file.
|
30 | 30 | <br />As part of the Infracost integration, I also created a `INFRACOST_API_KEY` and stored that as a GitHub Actions secret. I also managed the cost estimate process using a GitHub Actions variable `INFRACOST_SCAN_TYPE` where the value is either `hcl_code` or `tf_plan`, depending on the type of scan desired.
|
| 31 | +<!-- BEGIN_TF_DOCS --> |
| 32 | +## Requirements |
| 33 | + |
| 34 | +| Name | Version | |
| 35 | +|------|---------| |
| 36 | +| <a name="requirement_aws"></a> [aws](#requirement\_aws) | 5.20.1 | |
| 37 | +| <a name="requirement_random"></a> [random](#requirement\_random) | 3.6.3 | |
| 38 | + |
| 39 | +## Providers |
| 40 | + |
| 41 | +| Name | Version | |
| 42 | +|------|---------| |
| 43 | +| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.20.1 | |
| 44 | +| <a name="provider_random"></a> [random](#provider\_random) | 3.6.3 | |
| 45 | + |
| 46 | +## Modules |
| 47 | + |
| 48 | +| Name | Source | Version | |
| 49 | +|------|--------|---------| |
| 50 | +| <a name="module_vpc"></a> [vpc](#module\_vpc) | github.com/kunduso/terraform-aws-vpc | v1.0.1 | |
| 51 | + |
| 52 | +## Resources |
| 53 | + |
| 54 | +| Name | Type | |
| 55 | +|------|------| |
| 56 | +| [aws_cloudwatch_log_group.engine_log](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/cloudwatch_log_group) | resource | |
| 57 | +| [aws_cloudwatch_log_group.slow_log](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/cloudwatch_log_group) | resource | |
| 58 | +| [aws_elasticache_replication_group.app4](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/elasticache_replication_group) | resource | |
| 59 | +| [aws_elasticache_subnet_group.elasticache_subnet](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/elasticache_subnet_group) | resource | |
| 60 | +| [aws_iam_instance_profile.ec2_profile](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/iam_instance_profile) | resource | |
| 61 | +| [aws_iam_policy.secret_manager_policy](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/iam_policy) | resource | |
| 62 | +| [aws_iam_policy.ssm_parameter_policy](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/iam_policy) | resource | |
| 63 | +| [aws_iam_role.ec2_role](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/iam_role) | resource | |
| 64 | +| [aws_iam_role_policy_attachment.custom](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/iam_role_policy_attachment) | resource | |
| 65 | +| [aws_iam_role_policy_attachment.secret_policy_attachement](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/iam_role_policy_attachment) | resource | |
| 66 | +| [aws_iam_role_policy_attachment.ssm_policy_attachement](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/iam_role_policy_attachment) | resource | |
| 67 | +| [aws_instance.app-server-read](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/instance) | resource | |
| 68 | +| [aws_instance.app-server-write](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/instance) | resource | |
| 69 | +| [aws_kms_alias.encryption_rest](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/kms_alias) | resource | |
| 70 | +| [aws_kms_alias.encryption_secret](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/kms_alias) | resource | |
| 71 | +| [aws_kms_key.encryption_rest](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/kms_key) | resource | |
| 72 | +| [aws_kms_key.encryption_secret](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/kms_key) | resource | |
| 73 | +| [aws_kms_key_policy.encryption_rest_policy](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/kms_key_policy) | resource | |
| 74 | +| [aws_kms_key_policy.encryption_secret_policy](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/kms_key_policy) | resource | |
| 75 | +| [aws_secretsmanager_secret.elasticache_auth](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/secretsmanager_secret) | resource | |
| 76 | +| [aws_secretsmanager_secret_version.auth](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/secretsmanager_secret_version) | resource | |
| 77 | +| [aws_security_group.ec2_instance](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/security_group) | resource | |
| 78 | +| [aws_security_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/security_group) | resource | |
| 79 | +| [aws_security_group_rule.ec2_instance_egress](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/security_group_rule) | resource | |
| 80 | +| [aws_security_group_rule.ec2_instance_ingress](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/security_group_rule) | resource | |
| 81 | +| [aws_security_group_rule.elasticache_egress](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/security_group_rule) | resource | |
| 82 | +| [aws_security_group_rule.elasticache_ingress](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/security_group_rule) | resource | |
| 83 | +| [aws_ssm_parameter.elasticache_ep](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/ssm_parameter) | resource | |
| 84 | +| [aws_ssm_parameter.elasticache_port](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/resources/ssm_parameter) | resource | |
| 85 | +| [random_password.auth](https://registry.terraform.io/providers/hashicorp/random/3.6.3/docs/resources/password) | resource | |
| 86 | +| [aws_ami.amazon_ami](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/data-sources/ami) | data source | |
| 87 | +| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/5.20.1/docs/data-sources/caller_identity) | data source | |
| 88 | + |
| 89 | +## Inputs |
| 90 | + |
| 91 | +| Name | Description | Type | Default | Required | |
| 92 | +|------|-------------|------|---------|:--------:| |
| 93 | +| <a name="input_access_key"></a> [access\_key](#input\_access\_key) | The access\_key that belongs to the IAM user. | `string` | `""` | no | |
| 94 | +| <a name="input_ami_name"></a> [ami\_name](#input\_ami\_name) | The ami name of the image from where the instances will be created | `list(string)` | <pre>[<br/> "amzn2-ami-amd-hvm-2.0.20230727.0-x86_64-gp2"<br/>]</pre> | no | |
| 95 | +| <a name="input_instance_type"></a> [instance\_type](#input\_instance\_type) | The instance type of the EC2 instances | `string` | `"t3.medium"` | no | |
| 96 | +| <a name="input_name"></a> [name](#input\_name) | The name of the application. | `string` | `"app-4"` | no | |
| 97 | +| <a name="input_region"></a> [region](#input\_region) | AWS Cloud infrastructure region. | `string` | `"us-east-2"` | no | |
| 98 | +| <a name="input_secret_key"></a> [secret\_key](#input\_secret\_key) | The secret\_key that belongs to the IAM user. | `string` | `""` | no | |
| 99 | +| <a name="input_subnet_cidr_private"></a> [subnet\_cidr\_private](#input\_subnet\_cidr\_private) | CIDR blocks for the private subnets. | `list(any)` | <pre>[<br/> "10.20.32.0/27",<br/> "10.20.32.32/27",<br/> "10.20.32.64/27"<br/>]</pre> | no | |
| 100 | +| <a name="input_subnet_cidr_public"></a> [subnet\_cidr\_public](#input\_subnet\_cidr\_public) | CIDR blocks for the public subnets. | `list(any)` | <pre>[<br/> "10.20.32.96/27"<br/>]</pre> | no | |
| 101 | +| <a name="input_vpc_cidr"></a> [vpc\_cidr](#input\_vpc\_cidr) | CIDR for the VPC. | `string` | `"10.20.32.0/25"` | no | |
| 102 | + |
| 103 | +## Outputs |
| 104 | + |
| 105 | +No outputs. |
| 106 | +<!-- END_TF_DOCS --> |
31 | 107 | ## Usage
|
32 | 108 | Ensure that the policy attached to the IAM role whose credentials are being used in this configuration has permission to create and manage all the resources that are included in this repository.
|
33 | 109 |
|
34 | 110 | <br />Review the code including the [`terraform.yml`](./.github/workflows/terraform.yml) to understand the steps in the GitHub Actions pipeline. Also review the terraform code to understand all the concepts associated with creating an AWS VPC, subnets, internet gateway, route table, and route table association.
|
35 | 111 | <br />If you want to check the pipeline logs, click on the **Build Badge** (terrform-infra-provisioning) above the image in this ReadMe.
|
| 112 | +## Contributing |
| 113 | +If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request. Contributions are always welcome! |
36 | 114 | ## License
|
37 | 115 | This code is released under the Unlincse License. See [LICENSE](LICENSE).
|
0 commit comments