@@ -63,6 +63,80 @@ Validamos nuestra configuración
6363terraform validate
6464` ` `
6565
66+ Si todo va bien deberíamos ver:
67+
68+ ` ` ` bash
69+ Success! The configuration is valid.
70+ ` ` `
71+
72+ # ## Paso 4.
73+
74+ Recordar que debemos alimentar las variables de entorno:
75+
76+ ` ` ` bash
77+ AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
78+ AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
79+ ` ` `
80+
81+ # ## Paso 5.
82+
83+ Ahora podemos ejecutar la planificación
84+
85+ ` ` ` bash
86+ terraform plan -out d4.tfplan
87+ ` ` `
88+
89+ Obtenemos algo similar a esto:
90+
91+ ` ` ` bash
92+ Plan: 7 to add, 3 to change, 0 to destroy.
93+
94+ ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
95+
96+ Saved the plan to: d4.tfplan
97+
98+ To perform exactly these actions, run the following command to apply:
99+ terraform apply " d4.tfplan"
100+
101+ ` ` `
102+
103+ # ## Paso 6.
104+
105+ Ahora podemos aplicar el plan.
106+
107+ ` ` ` bash
108+ terraform apply " d4.tfplan"
109+ ` ` `
110+
111+ Pasados unos minutos veremos:
112+
113+ ` ` ` bash
114+ aws_s3_bucket.web_bucket: Creating...
115+ aws_s3_bucket.web_bucket: Creation complete after 5s [id= lc-web-app-20359]
116+ aws_s3_bucket_object.graphic: Creating...
117+ aws_s3_bucket_object.website: Creating...
118+ aws_lb.nginx: Modifying... [id= arn:aws:elasticloadbalancing:eu-west-3:092312727912:loadbalancer/app/lc-web-alb/8f8f5d121be16dfe]
119+ aws_s3_bucket_object.website: Creation complete after 1s [id= /website/index.html]
120+ aws_s3_bucket_object.graphic: Creation complete after 1s [id= /website/fruits.png]
121+ aws_lb.nginx: Still modifying... [id= arn:aws:elasticloadbalancing:eu-west-3:...lancer/app/lc-web-alb/8f8f5d121be16dfe, 10s elapsed]
122+ aws_lb.nginx: Still modifying... [id= arn:aws:elasticloadbalancing:eu-west-3:...lancer/app/lc-web-alb/8f8f5d121be16dfe, 20s elapsed]
123+ aws_lb.nginx: Still modifying... [id= arn:aws:elasticloadbalancing:eu-west-3:...lancer/app/lc-web-alb/8f8f5d121be16dfe, 30s elapsed]
124+ aws_lb.nginx: Modifications complete after 31s [id= arn:aws:elasticloadbalancing:eu-west-3:092312727912:loadbalancer/app/lc-web-alb/8f8f5d121be16dfe]
125+
126+ Apply complete! Resources: 3 added, 1 changed, 0 destroyed.
127+
128+ Outputs:
129+
130+ aws_instance_public_dns = " lc-web-alb-73418185.eu-west-3.elb.amazonaws.com"
131+ ` ` `
132+
133+ Visitemos la página del load balancer ` lc-web-alb-XXXXXX.eu-west-3.elb.amazonaws.com` y refrescar múltiples veces.
134+
135+ Nos podemos registrar en la consola de AWS y buscar el bucket ` lc-web-alb-XXXXXX` , deberíamos ser capaces de ver ` alb-logs` , ` AWSLogs` , ` XXXXXXXXXXXX` y aquí ver nuestros logs.
136+
137+ # ## Trouble shooting
138+
139+ https://github.com/hashicorp/terraform-provider-aws/issues/9896
66140
67141# # Clean Up
68142
0 commit comments