Currently supports only monolithic app with SQL Server as database (support for other databases are WIP). Terraform scripts will create Azure App Service, Azure SQL Server
- Docker installed with docker-compose and have push access to any of the docker repository like docker hub or Azure container registry.
- Azure CLI installed on your system. Terraform will require it to authenticate in Azure subscription.
- Terraform CLI installed on your system.
-
Execute generate app command and select app as Monolithic with Microsoft SQL server as database. Select yes to generate Terraform scripts. (default: is No)
-
Use docker-compose command to first build the docker image.
docker-compose -f docker/app.yml build
- Tag the image built during the previous step to push to docker repository by using
docker tag <source-image> <destination-image>:version/tag
- Push the image to docker hub or any docker service provider by using
docker push <destination-image>:version/tag
Note: The docker image link and its tag will use as input to Terraform variables. 5. In the generated app folder, change directory to the Terraform folder.
cd terraform
- Login into your Azure CLI by using
az login
Note: Terraform plan command will work only if the user is authenticated using Azure CLI.
- Create a file (terraform.tfvars) in the Terraform folder to provide input to the Terraform main script using below content:
location = "Central US"
subscription_id = "<your-azure-subscription>"
mssql_admin_user = "dbUser"
mssql_admin_password = "Password!12"
docker_image = "a5ingh/jhipster-dotnetcore-sampleapp"
docker_image_tag = "0.1"
-
Execute below terraform commands (one by one) to create resources (Azure app service, Azure SQL) and deploy as a docker image to app service:
terraform init
# to initialize terraform.terraform plan -out "MyAppPlan"
# can choose any name instead of MyAppPlan.terraform apply "MyAppPlan"
# it will create the resources and then provide you the link to your deployed app as output variable.
-
You can use
terraform destroy
to delete/remove all the created resources once you are done using it.