Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metascript removed chown commands #17

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,12 @@ resource "google_compute_instance" "webapp_instance" {

metadata_startup_script = <<-EOT
#!/bin/bash
touch /tmp/application.properties
sudo echo "spring.datasource.driver-class-name=org.postgresql.Driver" >> /tmp/application.properties
sudo echo "spring.datasource.url=jdbc:postgresql://${google_sql_database_instance.db_instance.private_ip_address}:5432/${var.db_name}" >> /tmp/application.properties
sudo echo "spring.datasource.username=${var.db_user}" >> /tmp/application.properties
sudo echo "spring.datasource.password=${random_password.password.result}" >> /tmp/application.properties
sudo echo "spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" >> /tmp/application.properties
sudo echo "spring.jpa.hibernate.ddl-auto=update" >> /tmp/application.properties
sudo mv /tmp/application.properties /opt/webapp/
sudo chmod 750 /opt/webapp/application.properties
sudo chown csye6225:csye6225 /opt/webapp/application.properties
sudo truncate -s 0 /opt/webapp/application.properties
sudo echo "spring.datasource.driver-class-name=org.postgresql.Driver" >> /opt/webapp/application.properties
sudo echo "spring.datasource.url=jdbc:postgresql://${google_sql_database_instance.db_instance.private_ip_address}:5432/${var.db_name}" >> /opt/webapp/application.properties
sudo echo "spring.datasource.username=${var.db_user}" >> /opt/webapp/application.properties
sudo echo "spring.datasource.password=${random_password.password.result}" >> /opt/webapp/application.properties
sudo echo "spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect" >> /opt/webapp/application.properties
sudo echo "spring.jpa.hibernate.ddl-auto=update" >> /opt/webapp/application.properties
EOT
}
Loading