Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 6b762c12 authored by Nicolas's avatar Nicolas
Browse files

feat: Add first step

parent afe0df25
No related branches found
No related tags found
No related merge requests found
Pipeline #3702 passed
...@@ -22,39 +22,39 @@ cache: ...@@ -22,39 +22,39 @@ cache:
paths: paths:
- ${TF_ROOT_GKE}/.terraform - ${TF_ROOT_GKE}/.terraform
#check-gke: check-gke:
# stage: gke stage: gke
# tags: tags:
# - docker - docker
# - cache - cache
# image: image:
# name: registry.gitlab.com/gitlab-org/terraform-images/stable:latest name: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
# entrypoint: [""] entrypoint: [""]
# variables: variables:
# TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/gke TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/gke
# TF_VAR_ec_apikey: $EC_API_KEY TF_VAR_ec_apikey: $EC_API_KEY
# TF_VAR_project_id: $GCP_PROJECT_ID TF_VAR_project_id: $GCP_PROJECT_ID
# TF_VAR_region: $GCP_REGION TF_VAR_region: $GCP_REGION
# TF_VAR_vpc_network_name: $GCP_NETWORK_NAME TF_VAR_vpc_network_name: $GCP_NETWORK_NAME
# TF_VAR_vpc_subnetwork_name: $GCP_SUBNETWORK_NAME TF_VAR_vpc_subnetwork_name: $GCP_SUBNETWORK_NAME
# GCP_SA: $GCP_SA GCP_SA: $GCP_SA
# before_script: before_script:
# - | - |
# cd $TF_ROOT_GKE cd $TF_ROOT_GKE
# echo $GCP_SA | base64 -d > gcp-sa.json echo $GCP_SA | base64 -d > gcp-sa.json
# script: script:
# - | - |
# gitlab-terraform init gitlab-terraform init
# gitlab-terraform validate gitlab-terraform validate
# gitlab-terraform fmt -check gitlab-terraform fmt -check
# gitlab-terraform plan gitlab-terraform plan
# gitlab-terraform plan-json gitlab-terraform plan-json
# artifacts: artifacts:
# name: plan name: plan
# paths: paths:
# - ${TF_ROOT_GKE}/plan.cache - ${TF_ROOT_GKE}/plan.cache
# reports: reports:
# terraform: ${TF_ROOT_GKE}/plan.json terraform: ${TF_ROOT_GKE}/plan.json
# #
#apply-gke: #apply-gke:
# stage: gke # stage: gke
...@@ -182,88 +182,88 @@ cache: ...@@ -182,88 +182,88 @@ cache:
# - | # - |
# sleep 1m # sleep 1m
destroy-psc: #destroy-psc:
stage: destroy # stage: destroy
# needs: # needs:
# - sleep # - sleep
tags: # tags:
- docker # - docker
- cache # - cache
image: # image:
name: google/cloud-sdk:slim # name: google/cloud-sdk:slim
entrypoint: [""] # entrypoint: [""]
variables: # variables:
GCP_PROJECT_ID: $GCP_PROJECT_ID # GCP_PROJECT_ID: $GCP_PROJECT_ID
GCP_REGION: $GCP_REGION # GCP_REGION: $GCP_REGION
GCP_NETWORK_NAME: $GCP_NETWORK_NAME # GCP_NETWORK_NAME: $GCP_NETWORK_NAME
GCP_SUBNETWORK_NAME: $GCP_SUBNETWORK_NAME # GCP_SUBNETWORK_NAME: $GCP_SUBNETWORK_NAME
GCP_INTERNAL_IP_NAME: $GCP_INTERNAL_IP_NAME # GCP_INTERNAL_IP_NAME: $GCP_INTERNAL_IP_NAME
GCP_PSC_NAME: $GCP_PSC_NAME # GCP_PSC_NAME: $GCP_PSC_NAME
GCP_DNS_ZONE_GKE_ELASTIC: $GCP_DNS_ZONE_GKE_ELASTIC # GCP_DNS_ZONE_GKE_ELASTIC: $GCP_DNS_ZONE_GKE_ELASTIC
EC_SERVICE_ATTACHMENT_URI: $EC_SERVICE_ATTACHMENT_URI # EC_SERVICE_ATTACHMENT_URI: $EC_SERVICE_ATTACHMENT_URI
EC_DNS_ZONE: $EC_DNS_ZONE # EC_DNS_ZONE: $EC_DNS_ZONE
GCP_SA: $GCP_SA # GCP_SA: $GCP_SA
before_script: # before_script:
- | # - |
echo $GCP_SA | base64 -d > gcp-sa.json # echo $GCP_SA | base64 -d > gcp-sa.json
gcloud auth activate-service-account --key-file gcp-sa.json # gcloud auth activate-service-account --key-file gcp-sa.json
echo "Activate Service Account: OK" # echo "Activate Service Account: OK"
gcloud config set project $GCP_PROJECT_ID # gcloud config set project $GCP_PROJECT_ID
echo "Set Project: OK" # echo "Set Project: OK"
cd $GCLOUD_ROOT_PSC # cd $GCLOUD_ROOT_PSC
script: # script:
- | # - |
chmod +x ./destroy-psc.sh # chmod +x ./destroy-psc.sh
./destroy-psc.sh # ./destroy-psc.sh
artifacts: # artifacts:
paths: # paths:
- ${CI_PROJECT_DIR}/pscConnectionId.env # - ${CI_PROJECT_DIR}/pscConnectionId.env
destroy-elastic:
stage: destroy
needs:
- destroy-psc
tags:
- docker
- cache
image:
name: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
entrypoint: [""]
variables:
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/elastic
TF_VAR_ec_apikey: $EC_API_KEY
before_script:
- |
export TF_VAR_psc_connection_id=$(cat ${CI_PROJECT_DIR}/pscConnectionId.env | grep GCP_PSC_CONNECTION_ID | cut -d = -f2)
cd $TF_ROOT_ELASTIC
script:
- |
gitlab-terraform init
gitlab-terraform destroy -auto-approve
destroy-gke: #destroy-elastic:
stage: destroy # stage: destroy
needs: # needs:
- destroy-psc # - destroy-psc
tags: # tags:
- docker # - docker
- cache # - cache
image: # image:
name: registry.gitlab.com/gitlab-org/terraform-images/stable:latest # name: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
entrypoint: [""] # entrypoint: [""]
variables: # variables:
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/gke # TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/elastic
TF_VAR_ec_apikey: $EC_API_KEY # TF_VAR_ec_apikey: $EC_API_KEY
TF_VAR_project_id: $GCP_PROJECT_ID # before_script:
TF_VAR_region: $GCP_REGION # - |
TF_VAR_vpc_network_name: $GCP_NETWORK_NAME # export TF_VAR_psc_connection_id=$(cat ${CI_PROJECT_DIR}/pscConnectionId.env | grep GCP_PSC_CONNECTION_ID | cut -d = -f2)
TF_VAR_vpc_subnetwork_name: $GCP_SUBNETWORK_NAME # cd $TF_ROOT_ELASTIC
GCP_SA: $GCP_SA # script:
before_script: # - |
- | # gitlab-terraform init
cd $TF_ROOT_GKE # gitlab-terraform destroy -auto-approve
echo "$GCP_SA" | base64 -d > gcp-sa.json #
script: #destroy-gke:
- | # stage: destroy
gitlab-terraform init # needs:
gitlab-terraform destroy -auto-approve # - destroy-psc
# tags:
# - docker
# - cache
# image:
# name: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
# entrypoint: [""]
# variables:
# TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/gke
# TF_VAR_ec_apikey: $EC_API_KEY
# TF_VAR_project_id: $GCP_PROJECT_ID
# TF_VAR_region: $GCP_REGION
# TF_VAR_vpc_network_name: $GCP_NETWORK_NAME
# TF_VAR_vpc_subnetwork_name: $GCP_SUBNETWORK_NAME
# GCP_SA: $GCP_SA
# before_script:
# - |
# cd $TF_ROOT_GKE
# echo "$GCP_SA" | base64 -d > gcp-sa.json
# script:
# - |
# gitlab-terraform init
# gitlab-terraform destroy -auto-approve
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment