Skip to content

Instantly share code, notes, and snippets.

View ngaffa's full-sized avatar

NAOUFAL EL GAFA ngaffa

View GitHub Profile
@ngaffa
ngaffa / eks-launch.tf
Last active March 10, 2023 21:05
EKS and Launch Template with the adequate sg
# Example of creating EKS Cluster terraform resources
resource "aws_eks_cluster" "eks_cluster" {
name = var.cluster_name
role_arn = var.eks_master_role_arn
version = var.cluster_version
enabled_cluster_log_types = ["api", "audit", "authenticator", "controllerManager", "scheduler"]
# Create a custome sg for other staff
vpc_config {
endpoint_private_access = true
endpoint_public_access = false
@ngaffa
ngaffa / eks_fargate_profile.tf
Last active March 10, 2023 20:18
Fargate Profile Example
# Create a Fargate Profile
resource "aws_eks_fargate_profile" "fp_local_default" {
cluster_name = data.terraform_remote_state.stack.outputs.eks_cluster_name
fargate_profile_name = "fargate"
pod_execution_role_arn = aws_iam_role.fargate_pod_execution_role.arn
subnet_ids = local.subnet_ids_list
selector {
namespace = "fargate-*"
@ngaffa
ngaffa / cloud-init.yaml
Last active July 13, 2023 01:14
Cloud Init for K8s and Docker
#cloud-config
package_update: true
package_upgrade: true
packages:
# Update the apt package index and install packages needed to use the Docker and Kubernetes apt repositories over HTTPS
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release