Deploy a container instance in Azure
Use Terraform on Azure to deploy IronSecureDoc Docker container and make its available with a public IP address and FQDN.
Prerequisites
Step 1: Clone GitHub Repository Template
We have the GitHub Repository template ready for you to clone and get started immediately here:
https://github.com/iron-software/IronSecureDoc-Terraform/Step 2: Modify all resource names
Modify all resource name in variables.tf
resource_group_name: Name of the resource group.resource_group_location: Location of the resource group. You can find the region from REGIONS.md use the second column to fill in this variable.container_group_name: Name of the container group.container_name: Name of the container.image_tag: The tag of the image to deploy can belatestor any number.- Other variables does not required to change.
Create secret.tfvars to contains all sensitive data and fill below variables
Azure Container Registry
main.tf appends below after dns_name_label = var.dns_name_label:
image_registry_credential {
server = var.registry_server
username = var.registry_username
password = var.registry_password
}variables.tf adds:
variable "registry_server" {
type = string
sensitive = false
description = "The server for the container registry. Required if the image is stored in a private registry."
}
variable "registry_username" {
type = string
sensitive = true
description = "Username for the container registry. Required if the image is stored in a private registry."
}
variable "registry_password" {
type = string
sensitive = true
description = "Password for the container registry. Required if the image is stored in a private registry."
default = "latest"
}secret.tfvars adds:
registry_server = "<registry-name>.azurecr.io"
registry_username = "YOUR-REGISTRY-USERNAME"
registry_password = "YOUR-REGISTRY-PASSWORD"
license_key = "YOUR-LICENSE-KEY"Docker Hub
secret.tfvars adds:
license_key = "YOUR-LICENSE-KEY"Step 3: Initialize Terraform
Run terraform init to initialize the Terraform deployment. This command downloads the Azure provider required to manage your Azure resources.
terraform init -upgradeStep 4: Create a Terraform execution plan
Run terraform plan to create an execution plan.
terraform plan -var-file="secret.tfvars" -out main.tfplanStep 5: Apply a Terraform execution plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
terraform apply main.tfplanStep 6: Verify the results
When you apply the execution plan, Terraform outputs the public IP address. To display the IP address again, run terraform output.
terraform output -raw container_ipv4_addressor display the FQDN.
terraform output -raw container_fqdnUse Postman or curl to validate. The result should return
pong.curl http://<container_ipv4_address>:8080/v1/document-services/pingcurl http://<container_ipv4_address>:8080/v1/document-services/pingSHELLor use FQDN
curl http://<container_fqdn>:8080/v1/document-services/pingcurl http://<container_fqdn>:8080/v1/document-services/pingSHELL
Step 7: Destroy the resource
- Create a execution plan for destroy resource
terraform plan -destroy -var-files="secret.tfvars" -out main.tfplan- Apply a execution destroy plan
terraform apply main.tfplan


