Terraform: 101-sql-database


Kiran Patnayakuni   |   Co-authors:  Anusha DokulaVeeresh Setty

Azure SQL Database

Description

This is a conversion of ARM template 101-sql-database  from the repository azure\azure-quickstart-templates  to Terraform configuration.

This configuration allows you to create Azure SQL Database, and it will deploy the following resources…

Note:

If the specified resource group is already exist then the script will not continue with the deployment. If you want to deploy the resources to the existing resource group, then import the resource group to state before deployment.

Syntax

# To initialize the configuration directory
PS C:\Terraform\101-sql-database> terraform init 

# To check the execution plan
PS C:\Terraform\101-sql-database> terraform plan

# To deploy the configuration
PS C:\Terraform\101-sql-database> terraform apply

Example

# Initialize
PS C:\Terraform\101-sql-database> terraform init 

# Plan
PS C:\Terraform\101-sql-database> terraform plan

  var.SQLServer
  The name of the SQL logical server.
  Enter a value: demosqlserver

  var.administratorLoginPassword
  The administrator password of the SQL logical server.
  Enter a value: ******

<--- output truncated --->

# Apply
PS C:\Terraform\101-sql-database> terraform apply 

  var.SQLServer
  The name of the SQL logical server.
  Enter a value: demosqlserver

  var.administratorLoginPassword
  The administrator password of the SQL logical server.
  Enter a value: ******

Output

azurerm_sql_server.SQL-Ser-01: Still creating..

<--- output truncated --->

azurerm_sql_database.SQL-Db-01: Creation complete after 1m13s

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Code

    View the code in GitHub  
Last modified: 21 August 2020

 iac  
 sql  
Share it on     |   |   |   | 
comments powered by Disqus