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 5e00467f authored by Nicolas's avatar Nicolas
Browse files

feat: Destroy PSC

parent 9f493193
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
echo "GCP_PSC_CONNECTION_ID=$(gcloud compute forwarding-rules describe $GCP_PSC_NAME --region=$GCP_REGION --format="get(pscConnectionId)")" > ${CI_PROJECT_DIR}/pscConnectionId.env echo "GCP_PSC_CONNECTION_ID=$(gcloud compute forwarding-rules describe $GCP_PSC_NAME --region=$GCP_REGION --format="get(pscConnectionId)")" > ${CI_PROJECT_DIR}/pscConnectionId.env
gcloud dns managed-zones describe $GCP_DNS_ZONE_GKE_ELASTIC > /dev/null 2>&1
DNS_ZONE_CREATED=$?
if [[ $DNS_ZONE_CREATED == 0 ]]; then
gcloud dns record-sets delete "*.$EC_DNS_ZONE." --type="A" --zone="$GCP_DNS_ZONE_GKE_ELASTIC"
gcloud dns managed-zones delete $GCP_DNS_ZONE_GKE_ELASTIC
else
echo 'DNS_ZONE_ALREADY_DELETED'
fi
FORWARDING_RULE_ACCEPTED=$(gcloud compute forwarding-rules describe $GCP_PSC_NAME --region=$GCP_REGION --format="get(pscConnectionStatus)")
if [[ $FORWARDING_RULE_ACCEPTED == "ACCEPTED" ]]; then
gcloud compute forwarding-rules delete $GCP_PSC_NAME --region=$GCP_REGION --quiet
else
echo 'FORWARDING_RULE_ALREADY_DELETED'
fi
ADDRESS_CREATED=$(gcloud compute addresses describe $GCP_INTERNAL_IP_NAME --region=$GCP_REGION --format="get(status)")
if [[ $ADDRESS_CREATED == "RESERVED" ]]; then
gcloud compute addresses delete $GCP_INTERNAL_IP_NAME --region=$GCP_REGION --quiet
else
echo 'ADDRESS_ALREADY_DELETED'
fi
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