VSDSCP-212 - refactoring and enabling int/ all prelive stages.
parent
0c65c5897c
commit
902b76e6ad
|
|
@ -0,0 +1,113 @@
|
||||||
|
String cloud_provider = "aws"
|
||||||
|
String aws_region = "ca-north-1"
|
||||||
|
String default_stage = "live"
|
||||||
|
String aws_access_credentials = "vsds_${aws_region}_${default_stage}_infrastructure.automation.user"
|
||||||
|
String dynatrace_api_token_credentials = "api_token_dynatrace_${aws_region}_${default_stage}"
|
||||||
|
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'vsds-terraform'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
AWS_ID = credentials("${aws_access_credentials}")
|
||||||
|
AWS_ACCESS_KEY_ID = "${env.AWS_ID_USR}"
|
||||||
|
AWS_SECRET_ACCESS_KEY = "${env.AWS_ID_PSW}"
|
||||||
|
|
||||||
|
AWS_REGION = "${aws_region}"
|
||||||
|
STAGE = "${default_stage}"
|
||||||
|
CLOUD_PROVIDER = "${cloud_provider}"
|
||||||
|
|
||||||
|
API_TOKEN = credentials("${dynatrace_api_token_credentials}")
|
||||||
|
TF_VAR_dt_api_token = "${env.API_TOKEN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
ansiColor('xterm')
|
||||||
|
disableConcurrentBuilds(abortPrevious: true)
|
||||||
|
timeout(time: 1, unit: 'HOURS')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('terraform init') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
sh """
|
||||||
|
set -e
|
||||||
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
||||||
|
terraform init
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Terraform plan') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
script {
|
||||||
|
env.PLAN_STATUS = sh(script: "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} && terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
||||||
|
if (env.PLAN_STATUS == "1") {
|
||||||
|
currentBuild.result = "FAILURE"
|
||||||
|
error('Aborting the build.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Interactive') {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 15, unit: "MINUTES") {
|
||||||
|
input "Is this plan acceptable?"
|
||||||
|
milestone 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("terraform apply") {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
container('terraform') {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
script {
|
||||||
|
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
||||||
|
sh("terraform apply -input=false .terraform/plan.out")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
|
||||||
|
script {
|
||||||
|
currentBuild.result = currentBuild.result ?: 'SUCCESS'
|
||||||
|
notifyBitbucket()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
dynatrace = {
|
||||||
|
version = "1.33.0"
|
||||||
|
source = "dynatrace-oss/dynatrace"
|
||||||
|
}
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = var.aws_region
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "dynatrace" {
|
||||||
|
dt_env_url = var.dt_env_url
|
||||||
|
dt_api_token = var.dt_api_token
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
aws_region = "ca-north-1"
|
||||||
|
|
||||||
|
dt_env_url = "https://console.eu.mon.vsds.swarm.audi/e/ /api"
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
variable "aws_region" {
|
||||||
|
description = "The aws region to deploy in"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_env_url" {
|
||||||
|
description = "Dynatrace Environment URL"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_api_token" {
|
||||||
|
description = "Dynatrace API Token"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
String cloud_provider = "aws"
|
||||||
|
String aws_region = "ca-north-1"
|
||||||
|
String default_stage = "prelive"
|
||||||
|
String aws_access_credentials = "vsds_${aws_region}_${default_stage}_infrastructure.automation.user"
|
||||||
|
String dynatrace_api_token_credentials = "api_token_dynatrace_${aws_region}_${default_stage}"
|
||||||
|
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'vsds-terraform'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
AWS_ID = credentials("${aws_access_credentials}")
|
||||||
|
AWS_ACCESS_KEY_ID = "${env.AWS_ID_USR}"
|
||||||
|
AWS_SECRET_ACCESS_KEY = "${env.AWS_ID_PSW}"
|
||||||
|
|
||||||
|
AWS_REGION = "${aws_region}"
|
||||||
|
STAGE = "${default_stage}"
|
||||||
|
CLOUD_PROVIDER = "${cloud_provider}"
|
||||||
|
|
||||||
|
API_TOKEN = credentials("${dynatrace_api_token_credentials}")
|
||||||
|
TF_VAR_dt_api_token = "${env.API_TOKEN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
ansiColor('xterm')
|
||||||
|
disableConcurrentBuilds(abortPrevious: true)
|
||||||
|
timeout(time: 1, unit: 'HOURS')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('terraform init') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
sh """
|
||||||
|
set -e
|
||||||
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
||||||
|
terraform init
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Terraform plan') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
script {
|
||||||
|
env.PLAN_STATUS = sh(script: "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} && terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
||||||
|
if (env.PLAN_STATUS == "1") {
|
||||||
|
currentBuild.result = "FAILURE"
|
||||||
|
error('Aborting the build.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Interactive') {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 15, unit: "MINUTES") {
|
||||||
|
input "Is this plan acceptable?"
|
||||||
|
milestone 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("terraform apply") {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
container('terraform') {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
script {
|
||||||
|
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
||||||
|
sh("terraform apply -input=false .terraform/plan.out")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
|
||||||
|
script {
|
||||||
|
currentBuild.result = currentBuild.result ?: 'SUCCESS'
|
||||||
|
notifyBitbucket()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
dynatrace = {
|
||||||
|
version = "1.33.0"
|
||||||
|
source = "dynatrace-oss/dynatrace"
|
||||||
|
}
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = var.aws_region
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "dynatrace" {
|
||||||
|
dt_env_url = var.dt_env_url
|
||||||
|
dt_api_token = var.dt_api_token
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
aws_region = "ca-north-1"
|
||||||
|
|
||||||
|
dt_env_url = "https://console.prelive.eu.mon.vsds.swarm.audi/e/307daede-db0a-4f56-90db-8953368c3d29/api"
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
variable "aws_region" {
|
||||||
|
description = "The aws region to deploy in"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_env_url" {
|
||||||
|
description = "Dynatrace Environment URL"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_api_token" {
|
||||||
|
description = "Dynatrace API Token"
|
||||||
|
}
|
||||||
|
|
@ -43,7 +43,6 @@ pipeline {
|
||||||
set -e
|
set -e
|
||||||
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
||||||
terraform init
|
terraform init
|
||||||
terraform fmt
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -55,9 +54,7 @@ pipeline {
|
||||||
sshagent(credentials: ['sofa-user-automation']) {
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
container('terraform') {
|
container('terraform') {
|
||||||
script {
|
script {
|
||||||
|
env.PLAN_STATUS = sh(script: "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} && terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
||||||
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
|
||||||
env.PLAN_STATUS = sh(script: "terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
|
||||||
if (env.PLAN_STATUS == "1") {
|
if (env.PLAN_STATUS == "1") {
|
||||||
currentBuild.result = "FAILURE"
|
currentBuild.result = "FAILURE"
|
||||||
error('Aborting the build.')
|
error('Aborting the build.')
|
||||||
|
|
@ -100,7 +97,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
String cloud_provider = "aws"
|
||||||
|
String aws_region = "eu-west-1"
|
||||||
|
String default_stage = "live"
|
||||||
|
String aws_access_credentials = "fdc_${aws_region}_${default_stage}_infrastructure.automation.user"
|
||||||
|
String dynatrace_api_token_credentials = "api_token_dynatrace_${aws_region}_${default_stage}"
|
||||||
|
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'vsds-terraform'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
AWS_ID = credentials("${aws_access_credentials}")
|
||||||
|
AWS_ACCESS_KEY_ID = "${env.AWS_ID_USR}"
|
||||||
|
AWS_SECRET_ACCESS_KEY = "${env.AWS_ID_PSW}"
|
||||||
|
|
||||||
|
AWS_REGION = "${aws_region}"
|
||||||
|
STAGE = "${default_stage}"
|
||||||
|
CLOUD_PROVIDER = "${cloud_provider}"
|
||||||
|
|
||||||
|
API_TOKEN = credentials("${dynatrace_api_token_credentials}")
|
||||||
|
TF_VAR_dt_api_token = "${env.API_TOKEN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
ansiColor('xterm')
|
||||||
|
disableConcurrentBuilds(abortPrevious: true)
|
||||||
|
timeout(time: 1, unit: 'HOURS')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('terraform init') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
sh """
|
||||||
|
set -e
|
||||||
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
||||||
|
terraform init
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Terraform plan') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
script {
|
||||||
|
env.PLAN_STATUS = sh(script: "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} && terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
||||||
|
if (env.PLAN_STATUS == "1") {
|
||||||
|
currentBuild.result = "FAILURE"
|
||||||
|
error('Aborting the build.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Interactive') {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 15, unit: "MINUTES") {
|
||||||
|
input "Is this plan acceptable?"
|
||||||
|
milestone 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("terraform apply") {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
container('terraform') {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
script {
|
||||||
|
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
||||||
|
sh("terraform apply -input=false .terraform/plan.out")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
|
||||||
|
script {
|
||||||
|
currentBuild.result = currentBuild.result ?: 'SUCCESS'
|
||||||
|
notifyBitbucket()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
dynatrace = {
|
||||||
|
version = "1.33.0"
|
||||||
|
source = "dynatrace-oss/dynatrace"
|
||||||
|
}
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = var.aws_region
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "dynatrace" {
|
||||||
|
dt_env_url = var.dt_env_url
|
||||||
|
dt_api_token = var.dt_api_token
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
aws_region = "eu-west-1"
|
||||||
|
|
||||||
|
dt_env_url = "https://console.eu.mon.vsds.swarm.audi/e/ /api"
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
variable "aws_region" {
|
||||||
|
description = "The aws region to deploy in"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_env_url" {
|
||||||
|
description = "Dynatrace Environment URL"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_api_token" {
|
||||||
|
description = "Dynatrace API Token"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
String cloud_provider = "aws"
|
||||||
|
String aws_region = "eu-west-1"
|
||||||
|
String default_stage = "prelive"
|
||||||
|
String aws_access_credentials = "fdc_${aws_region}_${default_stage}_infrastructure.automation.user"
|
||||||
|
String dynatrace_api_token_credentials = "api_token_dynatrace_${aws_region}_${default_stage}"
|
||||||
|
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'vsds-terraform'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
AWS_ID = credentials("${aws_access_credentials}")
|
||||||
|
AWS_ACCESS_KEY_ID = "${env.AWS_ID_USR}"
|
||||||
|
AWS_SECRET_ACCESS_KEY = "${env.AWS_ID_PSW}"
|
||||||
|
|
||||||
|
AWS_REGION = "${aws_region}"
|
||||||
|
STAGE = "${default_stage}"
|
||||||
|
CLOUD_PROVIDER = "${cloud_provider}"
|
||||||
|
|
||||||
|
API_TOKEN = credentials("${dynatrace_api_token_credentials}")
|
||||||
|
TF_VAR_dt_api_token = "${env.API_TOKEN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
ansiColor('xterm')
|
||||||
|
disableConcurrentBuilds(abortPrevious: true)
|
||||||
|
timeout(time: 1, unit: 'HOURS')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('terraform init') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
sh """
|
||||||
|
set -e
|
||||||
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
||||||
|
terraform init
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Terraform plan') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
script {
|
||||||
|
env.PLAN_STATUS = sh(script: "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} && terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
||||||
|
if (env.PLAN_STATUS == "1") {
|
||||||
|
currentBuild.result = "FAILURE"
|
||||||
|
error('Aborting the build.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Interactive') {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 15, unit: "MINUTES") {
|
||||||
|
input "Is this plan acceptable?"
|
||||||
|
milestone 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("terraform apply") {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
container('terraform') {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
script {
|
||||||
|
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
||||||
|
sh("terraform apply -input=false .terraform/plan.out")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
|
||||||
|
script {
|
||||||
|
currentBuild.result = currentBuild.result ?: 'SUCCESS'
|
||||||
|
notifyBitbucket()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
resource "dynatrace_audit_log" "test" {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
terraform {
|
terraform {
|
||||||
required_providers {
|
required_providers {
|
||||||
dynatrace = {
|
dynatrace = {
|
||||||
version = "1.31.0"
|
version = "1.33.0"
|
||||||
source = "dynatrace-oss/dynatrace"
|
source = "dynatrace-oss/dynatrace"
|
||||||
}
|
}
|
||||||
aws = {
|
aws = {
|
||||||
|
|
@ -13,4 +13,9 @@ terraform {
|
||||||
|
|
||||||
provider "aws" {
|
provider "aws" {
|
||||||
region = var.aws_region
|
region = var.aws_region
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider "dynatrace" {
|
||||||
|
dt_env_url = var.dt_env_url
|
||||||
|
dt_api_token = var.dt_api_token
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,3 @@
|
||||||
stack = "acdc"
|
|
||||||
stage = "prelive"
|
|
||||||
name = "dynatrace-prelive"
|
|
||||||
|
|
||||||
aws_region = "eu-west-1"
|
aws_region = "eu-west-1"
|
||||||
|
|
||||||
tags = {
|
dt_env_url = "https://console.prelive.eu.mon.vsds.swarm.audi/e/dfe67e08-75f1-4c0f-9433-16af192faf88/api"
|
||||||
"Managed_By" : "NTT_team"
|
|
||||||
}
|
|
||||||
|
|
||||||
kms = {
|
|
||||||
"s3" = "arn:aws:kms:eu-west-1:248567303878:key/8d860956-4033-4782-ab30-6cb84b31964e"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,10 @@ variable "aws_region" {
|
||||||
description = "The aws region to deploy in"
|
description = "The aws region to deploy in"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "name" {
|
variable "dt_env_url" {
|
||||||
description = "Name to be used on all the resources as identifier"
|
description = "Dynatrace Environment URL"
|
||||||
type = string
|
|
||||||
default = ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "stack" {
|
variable "dt_api_token" {
|
||||||
description = "Environment stack"
|
description = "Dynatrace API Token"
|
||||||
default = "vsds"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "stage" {
|
|
||||||
description = "Environment stage"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "tags" {
|
|
||||||
description = "A map of tags to add to all resources"
|
|
||||||
type = map(string)
|
|
||||||
default = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "kms" {
|
|
||||||
description = "A map of kms keys to be used for any resources."
|
|
||||||
type = map(string)
|
|
||||||
default = {}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
String cloud_provider = "aws"
|
||||||
|
String aws_region = "us-east-1"
|
||||||
|
String default_stage = "live"
|
||||||
|
String aws_access_credentials = "fdc_${aws_region}_${default_stage}_infrastructure.automation.user"
|
||||||
|
String dynatrace_api_token_credentials = "api_token_dynatrace_${aws_region}_${default_stage}"
|
||||||
|
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'vsds-terraform'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
AWS_ID = credentials("${aws_access_credentials}")
|
||||||
|
AWS_ACCESS_KEY_ID = "${env.AWS_ID_USR}"
|
||||||
|
AWS_SECRET_ACCESS_KEY = "${env.AWS_ID_PSW}"
|
||||||
|
|
||||||
|
AWS_REGION = "${aws_region}"
|
||||||
|
STAGE = "${default_stage}"
|
||||||
|
CLOUD_PROVIDER = "${cloud_provider}"
|
||||||
|
|
||||||
|
API_TOKEN = credentials("${dynatrace_api_token_credentials}")
|
||||||
|
TF_VAR_dt_api_token = "${env.API_TOKEN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
ansiColor('xterm')
|
||||||
|
disableConcurrentBuilds(abortPrevious: true)
|
||||||
|
timeout(time: 1, unit: 'HOURS')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('terraform init') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
sh """
|
||||||
|
set -e
|
||||||
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
||||||
|
terraform init
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Terraform plan') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
script {
|
||||||
|
env.PLAN_STATUS = sh(script: "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} && terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
||||||
|
if (env.PLAN_STATUS == "1") {
|
||||||
|
currentBuild.result = "FAILURE"
|
||||||
|
error('Aborting the build.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Interactive') {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 15, unit: "MINUTES") {
|
||||||
|
input "Is this plan acceptable?"
|
||||||
|
milestone 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("terraform apply") {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
container('terraform') {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
script {
|
||||||
|
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
||||||
|
sh("terraform apply -input=false .terraform/plan.out")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
|
||||||
|
script {
|
||||||
|
currentBuild.result = currentBuild.result ?: 'SUCCESS'
|
||||||
|
notifyBitbucket()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
dynatrace = {
|
||||||
|
version = "1.33.0"
|
||||||
|
source = "dynatrace-oss/dynatrace"
|
||||||
|
}
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = var.aws_region
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "dynatrace" {
|
||||||
|
dt_env_url = var.dt_env_url
|
||||||
|
dt_api_token = var.dt_api_token
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
aws_region = "us-east-1"
|
||||||
|
|
||||||
|
dt_env_url = ""
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
variable "aws_region" {
|
||||||
|
description = "The aws region to deploy in"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_env_url" {
|
||||||
|
description = "Dynatrace Environment URL"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dt_api_token" {
|
||||||
|
description = "Dynatrace API Token"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
String cloud_provider = "aws"
|
||||||
|
String aws_region = "us-east-1"
|
||||||
|
String default_stage = "prelive"
|
||||||
|
String aws_access_credentials = "fdc_${aws_region}_${default_stage}_infrastructure.automation.user"
|
||||||
|
String dynatrace_api_token_credentials = "api_token_dynatrace_${aws_region}_${default_stage}"
|
||||||
|
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
node {
|
||||||
|
label 'vsds-terraform'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
AWS_ID = credentials("${aws_access_credentials}")
|
||||||
|
AWS_ACCESS_KEY_ID = "${env.AWS_ID_USR}"
|
||||||
|
AWS_SECRET_ACCESS_KEY = "${env.AWS_ID_PSW}"
|
||||||
|
|
||||||
|
AWS_REGION = "${aws_region}"
|
||||||
|
STAGE = "${default_stage}"
|
||||||
|
CLOUD_PROVIDER = "${cloud_provider}"
|
||||||
|
|
||||||
|
API_TOKEN = credentials("${dynatrace_api_token_credentials}")
|
||||||
|
TF_VAR_dt_api_token = "${env.API_TOKEN}"
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
timestamps()
|
||||||
|
ansiColor('xterm')
|
||||||
|
disableConcurrentBuilds(abortPrevious: true)
|
||||||
|
timeout(time: 1, unit: 'HOURS')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('terraform init') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
sh """
|
||||||
|
set -e
|
||||||
|
cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE}
|
||||||
|
terraform init
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Terraform plan') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
container('terraform') {
|
||||||
|
script {
|
||||||
|
env.PLAN_STATUS = sh(script: "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} && terraform plan -out=.terraform/plan.out -input=false -detailed-exitcode", returnStatus: true)
|
||||||
|
if (env.PLAN_STATUS == "1") {
|
||||||
|
currentBuild.result = "FAILURE"
|
||||||
|
error('Aborting the build.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Interactive') {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 15, unit: "MINUTES") {
|
||||||
|
input "Is this plan acceptable?"
|
||||||
|
milestone 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("terraform apply") {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { env.PLAN_STATUS == "2" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
container('terraform') {
|
||||||
|
sshagent(credentials: ['sofa-user-automation']) {
|
||||||
|
script {
|
||||||
|
sh "cd environments/${CLOUD_PROVIDER}/${AWS_REGION}/${STAGE} "
|
||||||
|
sh("terraform apply -input=false .terraform/plan.out")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
|
||||||
|
script {
|
||||||
|
currentBuild.result = currentBuild.result ?: 'SUCCESS'
|
||||||
|
notifyBitbucket()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
resource "dynatrace_audit_log" "test" {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
terraform {
|
terraform {
|
||||||
required_providers {
|
required_providers {
|
||||||
dynatrace = {
|
dynatrace = {
|
||||||
version = "1.31.0"
|
version = "1.33.0"
|
||||||
source = "dynatrace-oss/dynatrace"
|
source = "dynatrace-oss/dynatrace"
|
||||||
}
|
}
|
||||||
aws = {
|
aws = {
|
||||||
|
|
@ -13,4 +13,9 @@ terraform {
|
||||||
|
|
||||||
provider "aws" {
|
provider "aws" {
|
||||||
region = var.aws_region
|
region = var.aws_region
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider "dynatrace" {
|
||||||
|
dt_env_url = var.dt_env_url
|
||||||
|
dt_api_token = var.dt_api_token
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,3 @@
|
||||||
stack = "acdc"
|
|
||||||
stage = "prelive"
|
|
||||||
name = "dynatrace-prelive"
|
|
||||||
|
|
||||||
aws_region = "us-east-1"
|
aws_region = "us-east-1"
|
||||||
|
|
||||||
tags = {
|
dt_env_url = "https://console.prelive.eu.mon.vsds.swarm.audi/e/e7acd689-2169-4b83-aace-8c4e75c67446/api"
|
||||||
"Managed_By" : "NTT_team"
|
|
||||||
}
|
|
||||||
|
|
||||||
kms = {
|
|
||||||
"s3" = "arn:aws:kms:eu-west-1:248567303878:key/8d860956-4033-4782-ab30-6cb84b31964e"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,10 @@ variable "aws_region" {
|
||||||
description = "The aws region to deploy in"
|
description = "The aws region to deploy in"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "name" {
|
variable "dt_env_url" {
|
||||||
description = "Name to be used on all the resources as identifier"
|
description = "Dynatrace Environment URL"
|
||||||
type = string
|
|
||||||
default = ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "stack" {
|
variable "dt_api_token" {
|
||||||
description = "Environment stack"
|
description = "Dynatrace API Token"
|
||||||
default = "vsds"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "stage" {
|
|
||||||
description = "Environment stage"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "tags" {
|
|
||||||
description = "A map of tags to add to all resources"
|
|
||||||
type = map(string)
|
|
||||||
default = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "kms" {
|
|
||||||
description = "A map of kms keys to be used for any resources."
|
|
||||||
type = map(string)
|
|
||||||
default = {}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue