mirror of
https://gitlab.sarex.io/infra/terraform-contour-mirror.git
synced 2026-08-08 21:21:34 +03:00
change pipeline generation + add tf dockerfile
This commit is contained in:
parent
c737d77f54
commit
06f4246c07
@ -3,7 +3,7 @@ stages:
|
|||||||
- trigger
|
- trigger
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
TERRAFORM_IMAGE_NAME: cr.yandex/crp3ccidau046kdj8g9q/terraform/terragrunt:v0.9.9
|
TERRAFORM_IMAGE_NAME: cr.yandex/crp3ccidau046kdj8g9q/terraform/terragrunt:v9.9
|
||||||
|
|
||||||
generate-pipeline:
|
generate-pipeline:
|
||||||
stage: generate
|
stage: generate
|
||||||
|
|||||||
@ -12,11 +12,8 @@ ARG TERRAGRUNT_VERSION=0.93.11
|
|||||||
RUN curl -fsSL https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 -o /usr/local/bin/terragrunt && \
|
RUN curl -fsSL https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 -o /usr/local/bin/terragrunt && \
|
||||||
chmod +x /usr/local/bin/terragrunt
|
chmod +x /usr/local/bin/terragrunt
|
||||||
|
|
||||||
# Create plugin cache directory - Terraform will download providers here from Yandex mirror
|
RUN mkdir -p /root/.terraform.d/plugin-cache && \
|
||||||
RUN mkdir -p /root/.terraform.d/plugin-cache
|
mkdir -p /root/.terraform.d && \
|
||||||
|
|
||||||
# Configure Terraform to use Yandex Terraform registry mirror
|
|
||||||
RUN mkdir -p /root/.terraform.d && \
|
|
||||||
echo 'provider_installation {' > /root/.terraformrc && \
|
echo 'provider_installation {' > /root/.terraformrc && \
|
||||||
echo ' network_mirror {' >> /root/.terraformrc && \
|
echo ' network_mirror {' >> /root/.terraformrc && \
|
||||||
echo ' url = "https://terraform-mirror.yandexcloud.net/"' >> /root/.terraformrc && \
|
echo ' url = "https://terraform-mirror.yandexcloud.net/"' >> /root/.terraformrc && \
|
||||||
|
|||||||
@ -91,11 +91,10 @@ validate-${job_prefix}:
|
|||||||
- cd \${TG_ROOT}
|
- cd \${TG_ROOT}
|
||||||
- ls -la
|
- ls -la
|
||||||
- rm -rf .terragrunt-cache
|
- rm -rf .terragrunt-cache
|
||||||
- export TF_PLUGIN_CACHE_DIR=/root/.terraform.d/plugins
|
- export TF_PLUGIN_CACHE_DIR=/root/.terraform.d/plugin-cache
|
||||||
script:
|
script:
|
||||||
- env | grep -E "(S3_|AWS_)" || echo "No S3/AWS vars found"
|
- env | grep -E "(S3_|AWS_)" || echo "No S3/AWS vars found"
|
||||||
- terragrunt init -reconfigure
|
- terragrunt init -reconfigure
|
||||||
- terragrunt validate-inputs
|
|
||||||
- terragrunt validate
|
- terragrunt validate
|
||||||
rules:
|
rules:
|
||||||
- if: '\$CI_PIPELINE_SOURCE == "merge_request_event"'
|
- if: '\$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
@ -129,12 +128,7 @@ plan-${job_prefix}:
|
|||||||
- ls -la
|
- ls -la
|
||||||
- rm -rf .terragrunt-cache
|
- rm -rf .terragrunt-cache
|
||||||
script:
|
script:
|
||||||
- terragrunt init -reconfigure || true
|
- terragrunt init -reconfigure
|
||||||
- echo "=== Checking generated backend.tf ==="
|
|
||||||
- find .terragrunt-cache -name "backend.tf" -exec echo "=== {} ===" \; -exec head -15 {} \; 2>/dev/null || echo "No backend.tf found"
|
|
||||||
- echo "=== Environment variables ==="
|
|
||||||
- env | grep -E "(S3_|AWS_)" || echo "No S3/AWS vars found"
|
|
||||||
- exit 1
|
|
||||||
- terragrunt plan -out=tfplan
|
- terragrunt plan -out=tfplan
|
||||||
rules:
|
rules:
|
||||||
- if: '\$CI_COMMIT_BRANCH == "master" || \$CI_COMMIT_BRANCH == "main"'
|
- if: '\$CI_COMMIT_BRANCH == "master" || \$CI_COMMIT_BRANCH == "main"'
|
||||||
@ -181,11 +175,6 @@ apply-${job_prefix}:
|
|||||||
- rm -rf .terragrunt-cache
|
- rm -rf .terragrunt-cache
|
||||||
script:
|
script:
|
||||||
- terragrunt init -reconfigure || true
|
- terragrunt init -reconfigure || true
|
||||||
- echo "=== Checking generated backend.tf ==="
|
|
||||||
- find .terragrunt-cache -name "backend.tf" -exec echo "=== {} ===" \; -exec head -15 {} \; 2>/dev/null || echo "No backend.tf found"
|
|
||||||
- echo "=== Environment variables ==="
|
|
||||||
- env | grep -E "(S3_|AWS_)" || echo "No S3/AWS vars found"
|
|
||||||
- exit 1
|
|
||||||
- terragrunt apply tfplan
|
- terragrunt apply tfplan
|
||||||
rules:
|
rules:
|
||||||
- if: '\$CI_COMMIT_BRANCH == "master" || \$CI_COMMIT_BRANCH == "main"'
|
- if: '\$CI_COMMIT_BRANCH == "master" || \$CI_COMMIT_BRANCH == "main"'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user