Skip to content

Commit

Permalink
datastore iac completed
Browse files Browse the repository at this point in the history
  • Loading branch information
anaiscalza committed Jan 20, 2024
1 parent af71a44 commit 6f4e229
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,17 @@ jobs:
terraform init
terraform plan -out datastore.tfplan
terraform apply datastore.tfplan
echo "MONGODB_URI=$(terraform output -raw cosmos_connection_string)" >> "$GITHUB_OUTPUT"
echo "POSTGRESQL_FQDN=$(terraform output -raw posgresql_fqdn)" >> "$GITHUB_OUTPUT"
echo "POSTGRESQL_ROOT_USERNAME=$(terraform output -raw posgresql_admin_username)" >> "$GITHUB_OUTPUT"
echo "POSTGRESQL_ROOT_PASSWORD=$(terraform output -raw posgresql_admin_password)" >> "$GITHUB_OUTPUT"
echo "REGISTRY_PASSWORD=$(terraform output -raw acr_token)" >> "$GITHUB_OUTPUT"
echo "REGISTRY_USERNAME=$(terraform output -raw acr_token_name)" >> "$GITHUB_OUTPUT"
echo "REGISTRY=$(terraform output -raw acr_server_name)" >> "$GITHUB_OUTPUT"
echo "REGISTRY_ID=$(terraform output -raw acr_id)" >> "$GITHUB_OUTPUT"
- name: Update Github actions secrets
working-directory: deployement
run: |
declare -A keys
keys["POSTGRESQL_FQDN"]=${{ steps.terraform.outputs.POSTGRESQL_FQDN }}
keys["REGISTRY"]=${{ steps.terraform.outputs.REGISTRY }}
keys["MONGODB_URI"]=$(terraform output -raw cosmos_connection_string)
keys["POSTGRESQL_FQDN"]=$(terraform output -raw posgresql_fqdn)
keys["POSTGRESQL_ROOT_USERNAME"]=$(terraform output -raw posgresql_admin_username)
keys["POSTGRESQL_ROOT_PASSWORD"]=$(terraform output -raw posgresql_admin_password)
# keys["REGISTRY_PASSWORD"]=$(terraform output -raw acr_token)
# keys["REGISTRY_USERNAME"]=$(terraform output -raw acr_token_name)
keys["REGISTRY"]=$(terraform output -raw acr_server_name)
keys["REGISTRY_ID"]=$(terraform output -raw acr_id)
cd ..
public_key_info=$(curl -H "Authorization: token $ACCESS_TOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/$ORG_NAME/$REPO_NAME/actions/secrets/public-key)
public_key_value=$(echo "$public_key_info" | jq -r '.key')
public_key_id=$(echo "$public_key_info" | jq -r '.key_id')
Expand All @@ -49,6 +44,3 @@ jobs:
echo '{"encrypted_value":"'${keys[$credential]}'","key_id":"'$public_key_id'"}' > body.json
curl -L -X PUT -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $ACCESS_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/$ORG_NAME/$REPO_NAME/actions/secrets/$credential -d @body.json
done
test=${{ secrets.REGISTRY }}
echo $test

0 comments on commit 6f4e229

Please sign in to comment.