The purpose of this Terraform template creates a high availability setup for GLPI using an EC2 instance, an RDS MariaDB instance and a shell script installing GLPI on a Linux server.
This README file provides a comprehensive guide on how to install and configure GLPI on an Ubuntu-based 20.04 system. I hope it helps you get started with using GLPI for your IT asset management needs.
- aws_key_pair: This resource creates an SSH key pair that will be used to connect to the EC2 instance where GLPI will be installed.
- aws_iam_instance_profile: This resource creates an IAM instance profile, which will be attached to the EC2 instance to provide it with the necessary permissions to access other AWS services like SSM.
- aws_iam_role: This resource creates an IAM role for the EC2 instance. It allows the EC2 instance to assume this role and access the authorized AWS services.
- aws_iam_role_policy: This resource attaches an IAM policy to the EC2 role. The ec2ssmcwlogsaccess_iam_policy and ec2ssmaccess_iam_policy policies grant the EC2 instance the required access to SSM and CloudWatch Logs services for management and monitoring.
- aws_db_subnet_group: This resource creates a subnet group for RDS. It specifies the private subnets where RDS will be deployed.
- aws_s3_bucket: This resource creates an S3 bucket that will be used to store a GLPI installation script.
- aws_s3_bucket_object: This resource creates an object in the previously created S3 bucket. The object contains a bash script that installs and configures GLPI on the EC2 instance.
- aws_instance: This resource deploys the EC2 instance where GLPI will be installed. It is configured with the SSH key, IAM instance profile, custom startup script, and other necessary parameters.
- aws_db_instance: This resource deploys an RDS instance to host the GLPI database. It uses the previously created subnet group and other specified configuration settings.
- aws_lb: This resource deploys an Application Load Balancer (ALB) for high availability and traffic distribution to the EC2 instance.
- aws_lb_target_group: This resource creates a target group for the ALB, specifying the EC2 instance as the target for traffic.
- aws_lb_listener: This resource configures a listener on the ALB to redirect incoming traffic to the target group.
Name | Version |
---|---|
aws | >= 3.0.0 |
Name | Version |
---|---|
aws | 5.7.0 |
local | 2.4.0 |
tls | 4.0.4 |
The following parameters must be passed to the variable.tf
file:
Name | Description | Type | Default | Required |
---|---|---|---|---|
AMI | Amazon Machine Image (AMI) ID | string |
n/a | yes |
EC2InstanceProfile | Instance profile for Systems Manager | string |
n/a | yes |
EC2InstanceType | EC2 instance type | string |
n/a | yes |
InternetGateway | Internet Gateway | string |
n/a | yes |
PrivateSubnetA | Private Subnet A | string |
n/a | yes |
PrivateSubnetB | Private Subnet B | string |
n/a | yes |
PublicSubnetA | Public Subnet A | string |
n/a | yes |
PublicSubnetB | Public Subnet B | string |
n/a | yes |
VPC | VPC Id | string |
n/a | yes |
bucket_name | Bucket Name | string |
n/a | yes |
encrypted_password | Encrypted GLPI password | string |
MySuperGlpi2022 | yes |
key_pair_name | Key Pair name | string |
n/a | yes |
multi_az | Multi AZ | bool |
true | yes |
policy_name | Policy Name | string |
n/a | yes |
region | AWS region | string |
n/a | yes |
Edit the variables.tf
with your own AWS configuration and userdata.sh
file with your bucket name.
To use Terraform with AWS, you can follow these steps:
terraform init && terraform apply --auto-approve
After running terraform apply, waits for the instance to be deployed, this takes a little time.
You should now be able to access to the GLPI web application by accessing your ALB's IP address in your web browser /glpi/index.php
. The GLPI setup wizard should appear, allowing you to complete the setup process and enjoy.
GLPI on RDS High Availability - CloudFormation
See CONTRIBUTING for more information.
This repository is licensed under the Apache License 2.0. See the LICENSE file.