first commit

main
ermisw 2023-10-03 21:07:40 +02:00
commit de09855edb
6 changed files with 194 additions and 0 deletions

34
.gitignore vendored Normal file
View File

@ -0,0 +1,34 @@
# Local .terraform directories
**/.terraform/*
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc

45
.terraform.lock.hcl Normal file
View File

@ -0,0 +1,45 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.7.0"
constraints = "~> 5.7.0"
hashes = [
"h1:SReCEKB29vK0duwz7Pk2bSCa2M2BqvtlFwS9Bqs3ADw=",
"zh:03240d7fc041d5331db7fd5f2ca4fe031321d07d2a6ca27085c5020dae13f211",
"zh:0b5252b14c354636fe0348823195dd901b457de1a033015f4a7d11cfe998c766",
"zh:2bfb62325b0487be8d1850a964f09cca0d45148faec577459c2a24334ec9977b",
"zh:2f9e317ffc57d2b5117cfe8dc266f88aa139b760bc93d8adeed7ad533a78b5a3",
"zh:36512725c9d7c559927b98fead04be58494a3a997e5270b905a75a468e307427",
"zh:5483e696d3ea764f746d3fe439f7dcc49001c3c774122d7baa51ce01011f0075",
"zh:5967635cc14f969ea26622863a2e3f9d6a7ddd3e7d35a29a7275c5e10579ac8c",
"zh:7e63c94a64af5b7aeb36ea6e3719962f65a7c28074532c02549a67212d410bb8",
"zh:8a7d5f33b11a3f5c7281413b431fa85de149ed8493ec1eea73d50d2d80a475e6",
"zh:8e2ed2d986aaf590975a79a2f6b5e60e0dc7d804ab01a8c03ab181e41cfe9b0f",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:9c7b8ca1b17489f16a6d0f1fc2aa9c130978ea74c9c861d8435410567a0a888f",
"zh:a54385896a70524063f0c5420be26ff6f88909bd8e6902dd3e922577b21fd546",
"zh:aecd3a8fb70b938b58d93459bfb311540fd6aaf981924bf34abd48f953b4be0d",
"zh:f3de076fa3402768d27af0187c6a677777b47691d1f0f84c9b259ff66e65953e",
]
}
provider "registry.terraform.io/hashicorp/helm" {
version = "2.11.0"
constraints = "2.11.0"
hashes = [
"h1:l+2Ni3UyoFRxyvxRblPQQYck1/iFmZKFy/UcI3ZRtjg=",
"zh:013857c88f3e19a4b162344e21dc51891c4ac8b600da8391f7fb2b6d234961e1",
"zh:044fffa233a93cdcf8384afbe9e1ab6c9d0b5b176cbae56ff465eb9611302975",
"zh:208b7cdd4fa3a1b25ae817dc00a9198ef98be0ddc3a577b5b72bc0f006afb997",
"zh:3e8b33f56cfe387277572a92037a1ca1cbe4e3aa6b5c19a8c2431193b07f7865",
"zh:7dd663d5619bd71676899b05b19d36f585189fdabc6b0b03c23579524a8fd9bf",
"zh:ae5329cb3e5bf0b86b02e823aac3ef3bd0d4b1618ff013cd0076dca0be8322e4",
"zh:ba6201695b55d51bedacdb017cb8d03d7a8ada51d0168ac44fef3fa791a85ab4",
"zh:c61285c8b1ba10f50cf94c9dcf98f2f3b720f14906a18be71b9b422279b5d806",
"zh:d522d388246f38b9f329c511ec579b516d212670b954f9dab64efb27e51862af",
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
"zh:f92546e26b670da61437ae2cbd038427c9374ce5f7a78df52193397da90bd997",
"zh:f9ad1407e5c0d5e3474094491025bf100828e8c1a01acdf9591d7dd1eb59f961",
]
}

46
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,46 @@
pipeline {
agent {
label 'terraform-slave'
}
// environment {
// //KUBECONFIG = credentials('kubernetes-config')
// }
stages {
// stage('test') {
// steps {
// sh 'python --version'
// }
// }
stage('TF Plan') {
// agent {
// docker {
// image 'hashicorp/terraform:latest'
// // Run the container on the node specified at the
// // top-level of the Pipeline, in the same workspace,
// // rather than on a new node entirely:
// args '--entrypoint="" -u root -v /opt/jenkins/.aws:/root/.aws'
// }
// }
steps {
container('terraform') {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "f89b3f7d-23ec-42b9-9687-e4acf01d7507",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh 'terraform version'
sh 'terraform init'
sh 'terraform apply'
}
}
}
}
// stage('Deploy Helm chart') {
// steps {
// sh "helm install ingress-nginx ./deploy/charts/ingress-nginx --namespace ingress-nginx --set controller.publishService.enabled=true --set controller.service.loadBalancerIP=${env.LB_IP}"
// }
// }
}
}

17
easytravel.tf Normal file
View File

@ -0,0 +1,17 @@
resource "helm_release" "easytravel" {
name = "easytravel"
repository = "https://gitea.nttdata-xlabs.com/api/packages/wiegee/helm"
chart = "easytravel"
namespace = "demo"
timeout = 500
depends_on = [
# helm_release.nginx-ingress,
# kubernetes_namespace.jenkins_namespace,
# kubectl_manifest.jenkins_volumes,
# kubectl_manifest.jenkins_sa,
# kubernetes_secret.oauth
]
}

52
terraform.tf Normal file
View File

@ -0,0 +1,52 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
data "aws_eks_cluster" "xOps" {
name = "xOps"
}
terraform {
backend "s3" {
bucket = "terraform-xops-demos"
key = "demo"
region = "us-west-2"
dynamodb_table = "terraform-xops-lock-state"
encrypt = true
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.7.0"
}
helm = {
version = "2.11.0"
}
}
required_version = "~> 1.3"
}
provider "aws" {
region = "us-west-2"
}
provider "helm" {
kubernetes {
host = data.aws_eks_cluster.xOps.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.xOps.certificate_authority[0].data)
exec {
api_version = "client.authentication.k8s.io/v1beta1"
args = ["eks", "get-token", "--cluster-name", data.aws_eks_cluster.xOps.name]
command = "aws"
}
}
}

0
variables.tf Normal file
View File