Skip to content

Commit 768338e

Browse files
authored
Merge pull request #23 from easyawslearn/22
22
2 parents d2da4e2 + bf0e09c commit 768338e

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

.github/workflows/terraform.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ jobs:
1818
with:
1919
version: "0.11.14"
2020
- name: Build module 'aws-instance-first-script'
21-
run: cd aws-instance-first-script && terraform init && terraform validate && terraform plan
21+
run: cd aws-instance-first-script && terraform init && terraform validate && terraform plan
22+
- name: Build module 'aws-EC2-with-jenkins'
23+
run: cd EC2withJenkins && terraform init && terraform validate && terraform plan

EC2withJenkins/provider.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
provider "aws" {
2-
region = "${var.region}"
3-
version = "~> 2.0"
2+
region = "${var.region}"
3+
version = "~> 2.0"
44
}

ebs-with-userdata/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# aws-instance-first-script
2+
3+
A Terraform module for creating AWS EC2 instance with userdata for creating EBS.
4+
5+
## Usage
6+
7+
```hcl
8+
module "ec2_instance" {
9+
source = "git::https://github.com/easyawslearn/Terraform-Tutorial.git/ebc-with-userdata"
10+
11+
region = "us-west-2"
12+
key-name = "ec2-demo"
13+
instance_type = "t2.micro"
14+
ebs_size = "20"
15+
}
16+
```
17+
18+
## Inputs
19+
20+
| Name | Description | Type | Default | Required |
21+
|------|-------------|:----:|:-----:|:-----:|
22+
| region | AWS region | string | us-east-1 | yes |
23+
| key-name | ec2 access key name | string | ec2-demo | yes |
24+
| instance_type | ec2 instance_type | string | t2.micro | yes |
25+
| ebs_size | EBS volume size | string | 20 | yes |

ebs-with-userdata/ebs_volume.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_ebs_volume" "ebs_volume" {
22
availability_zone = "us-east-1a"
3-
size = 20
3+
size = var.ebs_size
44
type = "gp2"
55

66
tags = {

ebs-with-userdata/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ variable "device_name" {
1919
type = "string"
2020
default = "/dev/xvdh"
2121
}
22+
23+
variable "ebs_size" {
24+
type = "string"
25+
default = "20"
26+
}
27+
2228
variable "key_name" {
2329
type = "string"
2430
default = "ec2-demo"

0 commit comments

Comments
 (0)