|
| 1 | +<!-- BEGIN_TF_DOCS --> |
| 2 | +## Requirements |
| 3 | + |
| 4 | +No requirements. |
| 5 | + |
| 6 | +## Providers |
| 7 | + |
| 8 | +| Name | Version | |
| 9 | +| ------------------------------------------------- | ------- | |
| 10 | +| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | |
| 11 | + |
| 12 | +## Modules |
| 13 | + |
| 14 | +| Name | Source | Version | |
| 15 | +| ----------------------------------------------------------------------- | --------------------------------------------------------- | ------- | |
| 16 | +| <a name="module_backup_role"></a> [backup\_role](#module\_backup\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role | 4.14.0 | |
| 17 | +| <a name="module_ec2_sg"></a> [ec2\_sg](#module\_ec2\_sg) | terraform-aws-modules/security-group/aws | 4.8.0 | |
| 18 | +| <a name="module_efs_sg"></a> [efs\_sg](#module\_efs\_sg) | terraform-aws-modules/security-group/aws | 4.8.0 | |
| 19 | +| <a name="module_iam_policy"></a> [iam\_policy](#module\_iam\_policy) | terraform-aws-modules/iam/aws//modules/iam-policy | 4.14.0 | |
| 20 | +| <a name="module_this_role"></a> [this\_role](#module\_this\_role) | terraform-aws-modules/iam/aws//modules/iam-assumable-role | 4.14.0 | |
| 21 | + |
| 22 | +## Resources |
| 23 | + |
| 24 | +| Name | Type | |
| 25 | +| -------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | |
| 26 | +| [aws_autoscaling_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group) | resource | |
| 27 | +| [aws_backup_plan.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/backup_plan) | resource | |
| 28 | +| [aws_backup_selection.efs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/backup_selection) | resource | |
| 29 | +| [aws_backup_vault.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/backup_vault) | resource | |
| 30 | +| [aws_efs_file_system.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_file_system) | resource | |
| 31 | +| [aws_efs_mount_target.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_mount_target) | resource | |
| 32 | +| [aws_eip.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource | |
| 33 | +| [aws_iam_instance_profile.this_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) | resource | |
| 34 | +| [aws_launch_template.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template) | resource | |
| 35 | +| [aws_ami.amazon_linux_2](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source | |
| 36 | +| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | |
| 37 | +| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | |
| 38 | + |
| 39 | +## Inputs |
| 40 | + |
| 41 | +| Name | Description | Type | Default | Required | |
| 42 | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | :------: | |
| 43 | +| <a name="input_encrypted"></a> [encrypted](#input\_encrypted) | Encrypt or not EFS | `bool` | `true` | no | |
| 44 | +| <a name="input_environment"></a> [environment](#input\_environment) | Environment name | `string` | `"infra"` | no | |
| 45 | +| <a name="input_ingress_with_cidr_blocks"></a> [ingress\_with\_cidr\_blocks](#input\_ingress\_with\_cidr\_blocks) | A list of Pritunl server security group rules where source is CIDR | <pre>list(object({<br> protocol = string<br> from_port = string<br> to_port = string<br> cidr_blocks = string<br> }))</pre> | `[]` | no | |
| 46 | +| <a name="input_ingress_with_source_security_group_id"></a> [ingress\_with\_source\_security\_group\_id](#input\_ingress\_with\_source\_security\_group\_id) | A list of Pritunl server security group rules where source is another security group | <pre>list(object({<br> protocol = string<br> from_port = string<br> to_port = string<br> security_groups = string<br> }))</pre> | `[]` | no | |
| 47 | +| <a name="input_instance_type"></a> [instance\_type](#input\_instance\_type) | Pritunl server instance type | `string` | `"t3.small"` | no | |
| 48 | +| <a name="input_kms_key_id"></a> [kms\_key\_id](#input\_kms\_key\_id) | KMS key ID in case of using CMK | `any` | `null` | no | |
| 49 | +| <a name="input_name"></a> [name](#input\_name) | Name used for all resources in this module | `string` | `"pritunl"` | no | |
| 50 | +| <a name="input_private_subnets"></a> [private\_subnets](#input\_private\_subnets) | A list of private subnets where EFS will be created | `list(any)` | n/a | yes | |
| 51 | +| <a name="input_public_subnets"></a> [public\_subnets](#input\_public\_subnets) | A list of public subnets where Pritunl server will be run | `list(any)` | n/a | yes | |
| 52 | +| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | ID of the VPC where to create security groups | `string` | n/a | yes | |
| 53 | + |
| 54 | +## Outputs |
| 55 | + |
| 56 | +| Name | Description | |
| 57 | +| ---------------------------------------------------------------------------------------------------------- | ----------- | |
| 58 | +| <a name="output_pritunl_endpoint"></a> [pritunl\_endpoint](#output\_pritunl\_endpoint) | n/a | |
| 59 | +| <a name="output_pritunl_security_group"></a> [pritunl\_security\_group](#output\_pritunl\_security\_group) | n/a | |
| 60 | +<!-- END_TF_DOCS --> |
| 61 | + |
| 62 | +## Architecture diagram |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +## Description |
| 67 | +* AWS ASG is used to automatically run "broken" instance again |
| 68 | +* The entire logic is located in user-data script: |
| 69 | + * Install MongoDB |
| 70 | + * Install Pritunl-server |
| 71 | + * Configure sysctl |
| 72 | + * Attache Elastic IP |
| 73 | + * Disable source-destination check, because this instance will forward traffic |
| 74 | + * Mount EFS filesystem into directory with MongoDB data. We don't want to care about AZ and EBS disks |
| 75 | +* AWS Backup is configured to backup EFS storage |
0 commit comments