I want to create an IaC script using Terraform, it will create a set of resources in AWS. One of the resources is an Ubuntu virtual machine that will run a GridDB database. I used this doc as a starting point – https://docs.griddb.net/latest/gettingstarted/using-apt/. According to the document, the default admin credentials are admin/admin, I’d like my script to change the password to some unique value (which will be unique for each customer). I am not quite sure how to proceed, since the command “gs_passwd admin” expects me to write the new password interactively. The example of code is shown below, could you please advise?
resource "aws_instance" "db01" {
ami = "ami-0750f57b80795fb10"
instance_type = "t2.micro"
user_data = <<-EOF
#!/bin/bash
echo "deb https://www.griddb.net/apt griddb/5.5 multiverse" > /etc/apt/sources.list.d/griddb.list
wget -qO - https://www.griddb.net/apt/griddb.asc | apt-key add -
apt update
apt install griddb-meta
systemctl start gridstore
gs_passwd admin
EOF
user_data_replace_on_change = true
security_groups = [aws_security_group.group01.id]
lifecycle {
create_before_destroy = true
}
tags = {
name = "Database Node"
}
}
Jacob_P is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.