-
Notifications
You must be signed in to change notification settings - Fork 36
/
README.yaml
205 lines (164 loc) · 6.26 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
# Name of this project
name: Terraform AWS EC2
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-ec2
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-aws-ec2.svg"
url: "https://github.com/clouddrove/terraform-aws-ec2/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-ec2/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-ec2/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.6.6"
providers:
- name: aws
url: https://aws.amazon.com/
version: ">= 5.31.0"
module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-aws-labels
description: Provides resource tagging.
# description of this project
description: |-
Terraform module to create an EC2 resource on AWS with ElasticC IP Addresses and Elastic Block Store.
# How to use this project
# How to use this project
usage: |-
Here is examples of how you can use this module in your inventory structure:
### Basic Example
```hcl
module "ec2" {
source = "clouddrove/ec2/aws"
version = "1.3.1"
name = "ec2"
environment = "test"
label_order = ["name", "environment"]
## security-group
vpc_id = module.vpc.vpc_id
ssh_allowed_ip = ["0.0.0.0/0"]
ssh_allowed_ports = [22]
#instance
instance_count = 1
ami = "ami-08d658f84a6d84a80"
instance_type = "c4.xlarge"
#Networking
subnet_ids = tolist(module.public_subnets.public_subnet_id)
#Keypair
public_key = "ssh-rsa ArJh5/gxz7sbSSseLd+ldHEOM3+lajUSGqWk3Bw/NgygEf1Kgw7gyK3jsTVVcokhK3TDuR3pi4u2QDR2tvLXddPKd37a2S7rjeqecw+XRW9559zKaR7RJJfjO1u1Onc2tgA3y0btdju2bcYBtFkRVOLwpog8CvslYEDV1Vf9HNeh9A3yOS6Pkjq6gDMrsUVF89ps3zuLmdVBIlCOnJDkwHK71lKihGKdkeXEtAj0aOQzAJsIpDFXz7vob9OiA/fb2T3t4R1EwEsPEnYVczKMsqUyqa+EE36bItcZHQyCPVN7+bRJyJpPcrfrsAa4yMtiHUUiecPdL/6HYwGHxxl2UQR5NE4NR35NI86Q+q1kNOc5VctxxQOTHBwKHaGvKLk4c5gHXaEl8yyYL0wVkL00KYx3GCh1LvRdQ"
#IAM
iam_instance_profile = module.iam-role.name
#Root Volume
root_block_device = [
{
volume_type = "gp2"
volume_size = 15
delete_on_termination = true
}
]
#EBS Volume
ebs_volume_enabled = false
ebs_volume_type = "gp2"
ebs_volume_size = 30
#Tags
instance_tags = { "snapshot" = true }
}
```
### ebs_mount
```hcl
module "ec2" {
source = "clouddrove/ec2/aws"
version = "1.3.1"
name = "ec2"
environment = "test"
label_order = ["name", "environment"]
## security group
vpc_id = module.vpc.vpc_id
ssh_allowed_ip = ["0.0.0.0/0"]
ssh_allowed_ports = [22]
#Instance
instance_count = 1
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
#Keypair
public_key = "HEOM3+lajUSGqWk3Bw/NgygEf1Kgw7gyK3jsTVVcokhK3TDuR3pi4u2QDR2tvLXddPKd37a2S7rjeqecw+XRW9559zKaR7RJJfjO1u1Onc2tgA3y0btdju2bcYBtFkRVOLwpog8CvslYEDLmdVBIlCOnJDkwHK71lKihGKdkeXEtAj0aOQzAJsIpDFXz7vob9OiA/fb2T3t4R1EwEsPEnYVczKMsqUyqa+EE36bItcZHQyCPVN7+bRJyJpPcrfrsAa4yMtiHUUiecPdL/6HYwGHxA5rUX3uD2UBm6sbGBH00ZCj6yUxl2UQR5NE4NR35NI86Q+q1kNOc5VctxxQOTHBwKHaGvKLk4c5gHXaEl8yyYL0wVkL00KYx3GCh1"
#Networking
subnet_ids = tolist(module.public_subnets.public_subnet_id)
#IAM
iam_instance_profile = module.iam-role.name
#Root Volume
root_block_device = [
{
volume_type = "gp2"
volume_size = 15
delete_on_termination = true
}
]
#EBS Volume
ebs_volume_enabled = true
ebs_volume_type = "gp2"
ebs_volume_size = 30
#Tags
instance_tags = { "snapshot" = true }
#Mount EBS With User Data
user_data = file("user-data.sh")
}
```
### spot-instance
```hcl
module "spot-ec2" {
source = "clouddrove/ec2/aws"
version = "1.3.1"
name = "ec2"
environment = "test"
label_order = ["name", "environment"]
## security-group
vpc_id = module.vpc.vpc_id
ssh_allowed_ip = ["0.0.0.0/0"]
ssh_allowed_ports = [22]
#Keypair
public_key = "h5/gxz7sbSSseLd+ldHEOM3+lajUSGqWk3Bw/NgygEf1Kgw7gyK3jsTVVcokhK3TDuR3pi4u2QDR2tvLXddPKd37a2S7rjeqecw+XRW9559zKaR7RJJfjO1u1Onc2tgA3y0btdju2bcYBtFkRVOLwpog8CvslYEDV1Vf9HNeh9A3yOS6Pkjq6gDMrsUVF89ps3zuLmdVBIlCOnJDkwHK71lKihGKdkeXEtAj0aOQzAJsIpDFXz7vob9OiA/fb2T3t4R1EwEsPEnYVczKMsqUyqa+EE36bItcZHQyCPVN7+bRJyJpPcrfrsAa4yMtiHUUiecPdL/6HYwGHxA5rUX3uD2UBm6sbGBHxQOTHBwKHaGvKLk4c5gHXaEl8yyYL0wVkL00KYx3GCh1LvRdQL8fvzImBCNg"
# Spot-instance
spot_price = "0.3"
spot_wait_for_fulfillment = true
spot_type = "persistent"
spot_instance_interruption_behavior = "terminate"
spot_instance_enabled = true
spot_instance_count = 1
spot_ami = "ami-08d658f84a6d84a80"
instance_type = "c4.xlarge"
#Networking
subnet_ids = tolist(module.public_subnets.public_subnet_id)
#IAM
iam_instance_profile = module.iam-role.name
#Root Volume
root_block_device = [
{
volume_type = "gp2"
volume_size = 15
delete_on_termination = true
}
]
#EBS Volume
ebs_volume_enabled = true
ebs_volume_type = "gp2"
ebs_volume_size = 30
#Tags
spot_instance_tags = { "snapshot" = true }
}
```