Skip to content

Terraform module to create Lightsail instance, Lightsail Key Pair (Optional), Lightsail Static IP (Optional), Metric alarm (Optional).

License

Notifications You must be signed in to change notification settings

mamrajyadav/terraform-aws-lightsail

 
 

Repository files navigation

Terraform AWS Lightsail

Terraform module to create Lightsail instance, Lightsail Key Pair (Optional), Lightsail Static IP (Optional).

Terraform Licence


We eat, drink, sleep and most importantly love DevOps. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy Bigger problems are always solved by breaking them into smaller manageable problems. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller connected yet manageable pieces within the infrastructure.

This module is basically combination of Terraform open source and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.

We have fifty plus terraform modules. A few of them are comepleted and are available for open source usage while a few others are in progress.

Prerequisites

This module has a few dependencies:

Examples

IMPORTANT: Since the master branch used in source varies based on new modifications, we suggest that you use the release versions here.

Simple Example

Here is an example of how you can use this module in your inventory structure:

    module "lightsail" {
      source        = "clouddrove/lightsail/aws"
      version       = "0.15.0"
      environment   = "test"
      name          = "lightsail"
      key_pair_name = "testing"
      label_order   = ["name", "environment"]
   }

Inputs

Name Description Type Default Required
attributes Additional attributes (e.g. 1). list(any) [] no
availability_zone The Availability Zone in which to create your instance string "ap-south-1a" no
blueprint_id The ID for a virtual private server image string "ubuntu_16_04_2" no
bundle_id The bundle of specification information string "micro_2_1" no
create_static_ip Create and attach a statis IP to the instance bool false no
delimiter Delimiter to be used between organization, environment, name and attributes. string "-" no
environment Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' string n/a yes
instance_count Number of instances to launch. number 1 no
instance_enabled Flag to control the instance creation. bool true no
key_pair_name The key name to use for the instance. string "" no
key_path Public key path (e.g. ~/.ssh/id_rsa.pub). string "" no
label_order Label order, e.g. name,application. list(any) [] no
lightsail_enabled Flag to control the lightsail instance creation. bool true no
managedby ManagedBy, eg 'CloudDrove'. string "hello@clouddrove.com" no
name Name (e.g. app or cluster). string "" no
pgp_key Flag to control the instance creation. any null no
public_key The public key material. This public key will be imported into Lightsail. string "" no
repository Terraform current module repo string "https://github.com/clouddrove/terraform-aws-lightsail" no
tags Additional tags (e.g. map(BusinessUnit,XYZ). map(any) {} no
use_default_key_pair Default key pair name will be used, you must keep 'key_pair_name' empty bool true no
user_data launch script to configure server with additional user data string "" no

Outputs

Name Description
arn The ARN of the Lightsail instance.
created_at The timestamp when the instance was created.
id The ARN of the Lightsail instance.
ip_address The Ip Address name of the Lightsail instance.
tags A mapping of tags to assign to the resource.

Testing

In this module testing is performed with terratest and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a GO environment in your system.

You need to run the following command in the testing folder:

  go test -run Test

Feedback

If you come accross a bug or have any feedback, please log it in our issue tracker, or feel free to drop us an email at hello@clouddrove.com.

If you have found it worth your time, go ahead and give us a ★ on our GitHub!

About us

At CloudDrove, we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.

We are The Cloud Experts!


We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.

About

Terraform module to create Lightsail instance, Lightsail Key Pair (Optional), Lightsail Static IP (Optional), Metric alarm (Optional).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 87.5%
  • Go 11.5%
  • Makefile 1.0%