Skip to content

Commit 27be3ff

Browse files
committed
incorporando nuevos providers en progreso
1 parent a62013e commit 27be3ff

3 files changed

Lines changed: 139 additions & 1 deletion

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Actualizando el Balancedor de carga y las instancias
2+
3+
## Pre requisitos
4+
5+
> Si has destruidfo el entorno recrealo
6+
7+
```bash
8+
cd lab/lc_web_app/
9+
terraform plan -out d3.tfplan
10+
terraform apply "d3.tfplan"
11+
```
12+
13+
## Pasos
14+
15+
### Paso 1. Actualizamos el Balanceador de Carga
16+
17+
Actualizamos `loadbalancer.tf`
18+
19+
```diff
20+
21+
## aws_lb
22+
resource "aws_lb" "nginx" {
23+
name = "lc-web-alb"
24+
internal = false
25+
load_balancer_type = "application"
26+
security_groups = [aws_security_group.alb_sg.id]
27+
subnets = [aws_subnet.subnet1.id, aws_subnet.subnet2.id]
28+
29+
enable_deletion_protection = false
30+
+
31+
+ access_logs {
32+
+ bucket = aws_s3_bucket.web_bucket.bucket
33+
+ prefix = "alb-logs"
34+
+ enabled = true
35+
+ }
36+
+
37+
tags = local.common_tags
38+
}
39+
```
40+
41+
### Paso 2. Actualizamos las instancias
42+
43+
```diff
44+
# INSTANCES #
45+
resource "aws_instance" "nginx1" {
46+
ami = nonsensitive(data.aws_ssm_parameter.ami.value)
47+
instance_type = var.aws_instance_type
48+
subnet_id = aws_subnet.subnet1.id
49+
vpc_security_group_ids = [aws_security_group.nginx-sg.id]
50+
+ iam_instance_profile = aws_iam_instance_profile.nginx_profile.name
51+
+ dependsdepends_on = [
52+
+ aws_iam_role_policy.allow_s3_all
53+
+ ]
54+
+
55+
user_data = <<EOF
56+
#! /bin/bash
57+
sudo amazon-linux-extras install -y nginx1
58+
sudo service nginx start
59+
sudo rm /usr/share/nginx/html/index.html
60+
echo '<html><head><title>Lemon Land Server</title></head><body style=\"background-color:#1F778D\"><p style=\"text-align: center;\"><span style=\"color:#FFFFFF;\"><span style=\"font-size:28px;\">Welcome to &#127819; land</span></span></p></body></html>' | sudo tee /usr/share/nginx/html/index.html
61+
EOF
62+
63+
tags = local.common_tags
64+
65+
}
66+
67+
resource "aws_instance" "nginx2" {
68+
ami = nonsensitive(data.aws_ssm_parameter.ami.value)
69+
instance_type = var.aws_instance_type
70+
subnet_id = aws_subnet.subnet2.id
71+
vpc_security_group_ids = [aws_security_group.nginx-sg.id]
72+
+ iam_instance_profile = aws_iam_instance_profile.nginx_profile.name
73+
+ dependsdepends_on = [
74+
+ aws_iam_role_policy.allow_s3_all
75+
+ ]
76+
+
77+
user_data = <<EOF
78+
#! /bin/bash
79+
sudo amazon-linux-extras install -y nginx1
80+
sudo service nginx start
81+
sudo rm /usr/share/nginx/html/index.html
82+
echo '<html><head><title>Lemon Land Server</title></head><body style=\"background-color:#1F778D\"><p style=\"text-align: center;\"><span style=\"color:#FFFFFF;\"><span style=\"font-size:28px;\">Welcome to &#127819; land</span></span></p></body></html>' | sudo tee /usr/share/nginx/html/index.html
83+
EOF
84+
85+
tags = local.common_tags
86+
87+
}
88+
89+
```
90+
91+
## Clean Up
92+
93+
```bash
94+
terraform destroy
95+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Actualizando el Startup Script
2+
3+
## Pre requisitos
4+
5+
> Si has destruidfo el entorno recrealo
6+
7+
```bash
8+
cd lab/lc_web_app/
9+
terraform plan -out d3.tfplan
10+
terraform apply "d3.tfplan"
11+
```
12+
13+
## Pasos
14+
15+
## Clean Up
16+
17+
```bash
18+
terraform destroy
19+
```

05-iac/00-terraform/05-incorporando-nuevos-providers/readme.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,28 @@ Cuando Terraform intenta hacer un despliegue, tiene que atravesar un proceso de
102102
103103
## Actualizando el Balancedor de carga y las instancias
104104

105-
[Actualizando el Balancedor de carga y las instancias - Demo 16](16-demo.md)
105+
[Actualizando el Balancedor de carga y las instancias - Demo 16](16-demo.md)
106+
107+
## Configuración Post Deployment
108+
109+
Después de que un recurso ha sido creado, a veces necesitamos realizar configuraciones `pos-deployment`
110+
111+
### Opciones de Configuración
112+
113+
* Resource
114+
* Pass data
115+
* Config Manager
116+
* Provisioner
117+
118+
### Provisioners
119+
120+
* Definidos en el recurso
121+
* Creación o destrucción
122+
* Múltiples provisioners
123+
* null_resource
124+
* Failure options
125+
* Último recurso
126+
127+
## Actualizando el Startup Script
128+
129+
[Actualizando el Startup Script - Demo 17](17-demo.md)

0 commit comments

Comments
 (0)