Terraform upgrade

This commit is contained in:
Marcus Noble 2021-02-10 10:26:47 +00:00
parent b7c90557df
commit 9de410bb6e
6 changed files with 121 additions and 32 deletions

File diff suppressed because one or more lines are too long

74
manifests/talks.yaml Normal file
View File

@ -0,0 +1,74 @@
apiVersion: v1
kind: Namespace
metadata:
name: talks
---
apiVersion: v1
kind: Service
metadata:
name: talks
namespace: talks
spec:
type: ClusterIP
ports:
- port: 80
targetPort: web
name: web
selector:
app: talks
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: talks
namespace: talks
spec:
replicas: 2
selector:
matchLabels:
app: talks
template:
metadata:
labels:
app: talks
spec:
containers:
- name: web
image: docker.cluster.fun/averagemarcus/talks:latest
imagePullPolicy: Always
ports:
- containerPort: 80
name: web
resources:
limits:
memory: 100Mi
requests:
memory: 100Mi
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: talks
namespace: talks
annotations:
cert-manager.io/cluster-issuer: letsencrypt
traefik.ingress.kubernetes.io/frontend-entry-points: http,https
traefik.ingress.kubernetes.io/redirect-entry-point: https
traefik.ingress.kubernetes.io/redirect-permanent: "true"
spec:
tls:
- hosts:
- talks.marcusnoble.co.uk
secretName: talks-ingress
rules:
- host: talks.marcusnoble.co.uk
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: talks
port:
number: 80

View File

@ -1,22 +1,6 @@
provider "helm" {
kubernetes {
load_config_file = false
host = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].host
token = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].token
cluster_ca_certificate = base64decode(
scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].cluster_ca_certificate
)
}
}
data "helm_repository" "fluxcd" {
name = "fluxcd"
url = "https://charts.fluxcd.io"
}
resource "helm_release" "helm-operator" { resource "helm_release" "helm-operator" {
name = "helm-operator" name = "helm-operator"
repository = data.helm_repository.fluxcd.metadata[0].name repository = "https://charts.fluxcd.io"
chart = "helm-operator" chart = "helm-operator"
max_history = 3 max_history = 3

View File

@ -1,12 +1,3 @@
provider "kubectl" {
load_config_file = false
host = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].host
token = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].token
cluster_ca_certificate = base64decode(
scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].cluster_ca_certificate
)
}
resource "kubectl_manifest" "manifests" { resource "kubectl_manifest" "manifests" {
for_each = fileset(path.module, "../manifests/*") for_each = fileset(path.module, "../manifests/*")
yaml_body = file(each.key) yaml_body = file(each.key)

View File

@ -3,3 +3,23 @@ provider "scaleway" {
region = "fr-par" region = "fr-par"
organization_id = "5c1e5e2a-a6cd-4eb3-907f-2a83a29668fc" organization_id = "5c1e5e2a-a6cd-4eb3-907f-2a83a29668fc"
} }
provider "helm" {
kubernetes {
load_config_file = false
host = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].host
token = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].token
cluster_ca_certificate = base64decode(
scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].cluster_ca_certificate
)
}
}
provider "kubectl" {
load_config_file = false
host = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].host
token = scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].token
cluster_ca_certificate = base64decode(
scaleway_k8s_cluster_beta.k8s-cluster.kubeconfig[0].cluster_ca_certificate
)
}

17
terraform/versions.tf Normal file
View File

@ -0,0 +1,17 @@
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
version = "1.3.2"
}
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.7.0"
}
scaleway = {
source = "scaleway/scaleway"
version = "1.17.2"
}
}
required_version = ">= 0.13"
}