Skip to content

Commit 5641363

Browse files
authored
Merge pull request #218 from Lemoncode/terraform-updates
Terraform updates
2 parents 3cf276f + 1741569 commit 5641363

93 files changed

Lines changed: 5055 additions & 72 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

04-cloud/01-eks/02-launching-cluster-eks/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ kind: ClusterConfig
3939
metadata:
4040
name: lc-cluster
4141
region: eu-west-3
42-
version: "1.21"
42+
version: "1.28"
4343

4444
iam:
4545
withOIDC: true
@@ -58,7 +58,7 @@ managedNodeGroups:
5858
```bash
5959
eksctl create cluster \
6060
--name lc-cluster \
61-
--version 1.21 \
61+
--version 1.28 \
6262
--region eu-west-3 \
6363
--nodegroup-name lc-nodes \
6464
--node-type t2.small \

04-cloud/01-eks/03-deploy-k8s-dashboard/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The official Kubernetes dashboard is not deployed by default, but there are inst
77
We can deploy the dashboard with the following command:
88

99
```bash
10-
export DASHBOARD_VERSION="v2.0.0"
10+
export DASHBOARD_VERSION="v2.7.0"
1111
```
1212

1313
```bash

04-cloud/01-eks/07-exposing-service/readme.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ This will create the `nginx-ingress` and the `network load balancer`
3939
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.49.3/deploy/static/provider/aws/deploy.yaml
4040
```
4141

42+
```bash
43+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/aws/deploy.yaml
44+
```
45+
4246
Create `apple.deploy.yaml`
4347

4448
```yaml
@@ -170,6 +174,9 @@ curl -I http://a2e47070555144b06a0cd99a242d6753-ef17945a5e983c95.elb.eu-west-3.
170174

171175
We get the following response
172176

177+
192.168.5.127
178+
31848
179+
173180
```
174181
HTTP/1.1 404 Not Found
175182
Server: nginx/1.17.10
@@ -225,4 +232,10 @@ Delete the cluster
225232

226233
```bash
227234
eksctl delete cluster --name=lc-cluster
228-
```
235+
```
236+
237+
## Updates
238+
239+
- [AWS LB Controller](https://aws.amazon.com/blogs/containers/exposing-kubernetes-applications-part-2-aws-load-balancer-controller/)
240+
- https://aws.amazon.com/blogs/containers/exposing-kubernetes-applications-part-3-nginx-ingress-controller/
241+
- https://aws.amazon.com/blogs/containers/exposing-kubernetes-applications-part-1-service-and-ingress-resources/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
7+
"features": {
8+
"ghcr.io/devcontainers/features/aws-cli:1": {},
9+
"ghcr.io/devcontainers/features/azure-cli:1": {},
10+
"ghcr.io/devcontainers/features/terraform:1": {}
11+
},
12+
13+
// Features to add to the dev container. More info: https://containers.dev/features.
14+
// "features": {},
15+
16+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
17+
// "forwardPorts": [],
18+
19+
// Use 'postCreateCommand' to run commands after the container is created.
20+
// "postCreateCommand": "uname -a",
21+
22+
// Configure tool-specific properties.
23+
// "customizations": {},
24+
25+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
26+
"remoteUser": "root"
27+
}

05-iac/00-terraform/03-desplegando-config-base/readme.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ aws_instance.web_server.name
4141

4242
Abrimos `./.start-app/main.tf`
4343

44-
```tf
44+
```ini
4545
provider "aws" {
4646
access_key = "ACCESS_KEY"
4747
secret_key = "SECRET_KEY"
@@ -51,7 +51,7 @@ provider "aws" {
5151

5252
Este bloque le indica a Terraform que usaremos `AWS` como **provider**.
5353

54-
```tf
54+
```ini
5555
data "aws_ssm_parameter" "ami" {
5656
name = "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
5757
}
@@ -63,7 +63,7 @@ Este es un **service manager parameter**, al cual le damos como nombre de etique
6363

6464
En la sección de `NETWORKING` creamos la `VPC`
6565

66-
```tf
66+
```ini
6767
resource "aws_vpc" "vpc" {
6868
cidr_block = "10.0.0.0/16"
6969
enable_dns_hostnames = "true"
@@ -73,7 +73,7 @@ resource "aws_vpc" "vpc" {
7373

7474
Después creamos la `internet gateway`, y lo asociamos con la VPC que creamos previamente. Para tal fin usamos `vpc_id = aws_vpc.vpc.id`
7575

76-
```tf
76+
```ini
7777
resource "aws_internet_gateway" "igw" {
7878
vpc_id = aws_vpc.vpc.id
7979

@@ -84,7 +84,7 @@ resource "aws_internet_gateway" "igw" {
8484
8585
Creamos una `subnet` asociada a la `VPC`. Gracias a esta entrada `map_public_ip_on_launch = "true"`, obtenemos una IP pública
8686

87-
```tf
87+
```ini
8888
resource "aws_subnet" "subnet1" {
8989
cidr_block = "10.0.0.0/24"
9090
vpc_id = aws_vpc.vpc.id
@@ -94,7 +94,7 @@ resource "aws_subnet" "subnet1" {
9494

9595
Creamos una `route table`, y la asociamos a nuestra `VPC`. Para ver la documentación oficial de este recurso, seguir el siguiente enlace [Route tables official Docs](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html)
9696

97-
```tf
97+
```ini
9898
resource "aws_route_table" "rtb" {
9999
vpc_id = aws_vpc.vpc.id
100100

@@ -109,7 +109,7 @@ En el bloque anidado, podemos especificar un `route` para añadir a la `route ta
109109

110110
Por último asociamos nuestra `route table` con una única `subnet`
111111

112-
```tf
112+
```ini
113113
resource "aws_route_table_association" "rta-subnet1" {
114114
subnet_id = aws_subnet.subnet1.id
115115
route_table_id = aws_route_table.rtb.id
@@ -118,7 +118,7 @@ resource "aws_route_table_association" "rta-subnet1" {
118118

119119
Creamos un `security group` que permita al puerto 80 de cualquier dirección hablar nuestra instancia `EC2`
120120

121-
```tf
121+
```ini
122122
# Nginx security group
123123
resource "aws_security_group" "nginx-sg" {
124124
name = "nginx_sg"
@@ -146,7 +146,7 @@ Estamos asocaindo este `security group` con nuestra `VPC`, y estamos creando un
146146

147147
Por último tenemos la instancia EC2.
148148

149-
```tf
149+
```ini
150150
resource "aws_instance" "nginx1" {
151151
ami = nonsensitive(data.aws_ssm_parameter.ami.value)
152152
instance_type = "t2.micro"

05-iac/00-terraform/04-usando-inputs-outputs/02-demo.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ resource "aws_security_group" "nginx-sg" {
245245
}
246246
# ....
247247
```
248-
mapas entradas en `variables.tf` para las instancias
248+
249+
Creamos entradas en `variables.tf` para las instancias
249250

250251
```diff
251252

05-iac/00-terraform/05-incorporando-recursos/11-demo.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ resource "aws_lb_target_group" "nginx" {
162162
163163
```
164164
165+
```bash
166+
terraform validate
167+
```
168+
165169
### Paso 2. Crear el plan
166170
167171
Ahora estamos listos, para generar el `plan`, pero antes registrar las credenciales, si no están registradas en la terminal:

05-iac/00-terraform/06-incorporando-nuevos-providers/12-demo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ Aquí podemos encontrar un [ejemplo de uso del provider](https://registry.terraf
2424

2525
Creamos el fichero `./lab/lc_web_app/providers.tf`
2626

27-
```tf
27+
```ini
2828
terraform {
2929
required_providers {
3030
aws = {
3131
source = "hashicorp/aws"
32-
version = "~> 3.0"
32+
version = "~> 5.0"
3333
}
3434
}
3535
}
@@ -82,7 +82,7 @@ terraform {
8282
required_providers {
8383
aws = {
8484
source = "hashicorp/aws"
85-
version = "~> 3.0"
85+
version = "~> 5.0"
8686
}
8787
}
8888
}

05-iac/00-terraform/06-incorporando-nuevos-providers/13-demo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ terraform {
2929
required_providers {
3030
aws = {
3131
source = "hashicorp/aws"
32-
version = "~> 3.0"
32+
version = "~> 5.0"
3333
}
3434
+
3535
+ random = {

05-iac/00-terraform/06-incorporando-nuevos-providers/14-demo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Crear `lab/lc_web_app/s3.tf`
1919
```tf
2020
# aws_s3_bucket
2121
22-
# aws_s3_bucket_acl
23-
2422
# aws_s3_bucket_policy
2523
24+
# aws_s3_object
25+
2626
# aws_iam_role
2727
2828
# aws_iam_role_policy

0 commit comments

Comments
 (0)