Skip to content

Commit bf0e09c

Browse files
committed
added Readme file and change ebs size static to dynamic
1 parent 293c338 commit bf0e09c

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

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)