mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
change tf secret strategy
This commit is contained in:
parent
f282b80b55
commit
9ac676192e
3 changed files with 10 additions and 5 deletions
6
.github/workflows/terraform-ci.yml
vendored
6
.github/workflows/terraform-ci.yml
vendored
|
@ -26,12 +26,11 @@ jobs:
|
||||||
run: terraform init
|
run: terraform init
|
||||||
env:
|
env:
|
||||||
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
||||||
- name: Replace secret
|
|
||||||
run: sed -i "s/POSTGRES_PASSWORD/${{ secrets.POSTGRES_PASSWORD }}/" main.tf
|
|
||||||
- name: Dry run Terraform
|
- name: Dry run Terraform
|
||||||
run: terraform plan -var-file=variables.tfvars
|
run: terraform plan -var-file=variables.tfvars
|
||||||
env:
|
env:
|
||||||
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
||||||
|
TF_VAR_db_password: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
|
|
||||||
terraform-deploy:
|
terraform-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -56,4 +55,5 @@ jobs:
|
||||||
- name: Deploy Terraform
|
- name: Deploy Terraform
|
||||||
run: terraform apply -var-file=variables.tfvars -auto-approve
|
run: terraform apply -var-file=variables.tfvars -auto-approve
|
||||||
env:
|
env:
|
||||||
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
GOOGLE_CREDENTIALS: ${{ secrets.GCP_JSON }}
|
||||||
|
TF_VAR_db_password: ${{ secrets.POSTGRES_PASSWORD }}
|
|
@ -55,7 +55,7 @@ resource "google_sql_database_instance" "petclinic" {
|
||||||
resource "google_sql_user" "users" {
|
resource "google_sql_user" "users" {
|
||||||
name = var.app
|
name = var.app
|
||||||
instance = google_sql_database_instance.petclinic.name
|
instance = google_sql_database_instance.petclinic.name
|
||||||
password = POSTGRES_PASSWORD
|
password = var.postgres_password
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_sql_database" "database" {
|
resource "google_sql_database" "database" {
|
||||||
|
|
|
@ -46,4 +46,9 @@ variable "db_version" {
|
||||||
variable "db_tier" {
|
variable "db_tier" {
|
||||||
type = string
|
type = string
|
||||||
description = "Tier of CloudSQL in GCP"
|
description = "Tier of CloudSQL in GCP"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "db_password" {
|
||||||
|
type = string
|
||||||
|
description = "Password for CloudSQL instance in GCP"
|
||||||
|
}
|
Loading…
Reference in a new issue