mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 07:12:20 -05:00
migrate csv_upload_bucket to new provider
This commit is contained in:
41
.github/workflows/deploy.yml
vendored
41
.github/workflows/deploy.yml
vendored
@@ -48,22 +48,31 @@ jobs:
|
|||||||
# 2. Go back to main.tf and update the module syntax and parameters for the new provider
|
# 2. Go back to main.tf and update the module syntax and parameters for the new provider
|
||||||
# 3. Go through the CI/CD again, at this point it should work.
|
# 3. Go through the CI/CD again, at this point it should work.
|
||||||
#
|
#
|
||||||
# - name: Terraform change provider
|
- name: Terraform change provider
|
||||||
# working-directory: terraform/staging
|
working-directory: terraform/staging
|
||||||
# env:
|
env:
|
||||||
# AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
||||||
# TF_VAR_cf_user: ${{ secrets.CLOUDGOV_USERNAME }}
|
TF_VAR_cf_user: ${{ secrets.CLOUDGOV_USERNAME }}
|
||||||
# TF_VAR_cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
|
TF_VAR_cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
|
||||||
# run: |
|
run: |
|
||||||
# terraform state pull | jq '
|
set -euo pipefail
|
||||||
# .resources |= map(select(.module == "module.csv_upload_bucket"))
|
echo "Finding all resources in module.csv_upload_bucket..."
|
||||||
# ' > module-csv_upload_bucket.tfstate
|
resources=$(terraform state list | grep '^module.csv_upload_bucket' || true)
|
||||||
# terraform state replace-provider \
|
if [ -z "$resources" ]; then
|
||||||
# -state=module-csv_upload_bucket.tfstate \
|
echo "No resources found under module.csv_upload_bucket -- skipping migration."
|
||||||
# 'registry.terraform.io/cloudfoundry-community/cloudfoundry' \
|
exit 0
|
||||||
# 'registry.terraform.io/cloudfoundry/cloudfoundry'
|
fi
|
||||||
# terraform state push module-csv_upload_bucket.tfstate
|
echo "Migrating provider for these resources:"
|
||||||
|
echo "$resources"
|
||||||
|
terraform state replace-provider \
|
||||||
|
'registry.terraform.io/cloudfoundry-community/cloudfoundry' \
|
||||||
|
'registry.terraform.io/cloudfoundry/cloudfoundry' \
|
||||||
|
$resources
|
||||||
|
|
||||||
|
echo "Provider migration complete."
|
||||||
|
echo "Verifying..."
|
||||||
|
terraform state show $(echo "$resources" | head -n 1) | grep 'provider'
|
||||||
|
|
||||||
- name: Terraform apply
|
- name: Terraform apply
|
||||||
working-directory: terraform/staging
|
working-directory: terraform/staging
|
||||||
|
|||||||
Reference in New Issue
Block a user