Deploy a C# Container Instance in Azure
Use Terraform on Azure to deploy the IronSecureDoc Docker container and make it 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 Names in variables.tf
resource_group_name: Name of the resource group.resource_group_location: Location of the resource group. You can find the region fromREGIONS.mdand 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; it can belatestor any specific version number.- Other variables do not need to be changed.
Create secret.tfvars to Contain All Sensitive Data
Populate the following variables in secret.tfvars.
Azure Container Registry
Append to main.tf after dns_name_label = var.dns_name_label:
image_registry_credential {
server = var.registry_server
username = var.registry_username
password = var.registry_password
}
Add to variables.tf:
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."
}
Add to secret.tfvars:
registry_server = "<registry-name>.azurecr.io"
registry_username = "YOUR-REGISTRY-USERNAME"
registry_password = "YOUR-REGISTRY-PASSWORD"
license_key = "YOUR-LICENSE-KEY"
Docker Hub
Add to secret.tfvars:
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 -upgrade
Step 4: Create a Terraform Execution Plan
Run terraform plan to create an execution plan.
terraform plan -var-file="secret.tfvars" -out main.tfplan
Step 5: Apply a Terraform Execution Plan
Run terraform apply to apply the execution plan to your cloud infrastructure.
terraform apply main.tfplan
Step 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_addressSHELLOr display the FQDN.
terraform output -raw container_fqdnSHELL -
Use Postman or
curlto validate. The expected result should returnpong.curl http://<container_ipv4_address>:8080/v1/document-services/pingSHELLOr use the FQDN.
curl http://<container_fqdn>:8080/v1/document-services/pingSHELL
Step 7: Destroy the Resource
-
Create an execution plan for destroying the resource.
terraform plan -destroy -var-file="secret.tfvars" -out main.tfplanSHELL -
Apply an execution destroy plan.
terraform apply main.tfplanSHELL
Frequently Asked Questions
What is the main purpose of deploying IronSecureDoc in Azure using Terraform?
The main purpose is to securely manage and deploy the IronSecureDoc container on Azure, enabling public access through a public IP address and FQDN while ensuring document security.
What are the prerequisites for setting up IronSecureDoc on Azure with Terraform?
To set up IronSecureDoc on Azure with Terraform, you need to install and configure Terraform and authenticate it to Azure using the provided guidelines.
How can I clone the GitHub Repository Template for IronSecureDoc?
You can clone the GitHub Repository Template for IronSecureDoc from the following URL: https://github.com/iron-software/IronSecureDoc-Terraform/.
Which Terraform file should I modify to change resource names for IronSecureDoc deployment?
Modify the `variables.tf` file to change resource names such as resource group name, container group name, and container name for IronSecureDoc deployment.
How should I handle sensitive data for the IronSecureDoc Azure deployment?
Sensitive data should be stored in a `secret.tfvars` file, which includes sensitive variables such as registry server, username, password, and license key, necessary for secure deployment.
How do I use a private registry for storing the IronSecureDoc image in Azure?
To use a private registry, append the image registry credentials block to `main.tf` and add necessary variables in `variables.tf` and `secret.tfvars` to provide registry server, username, and password.
What command initializes the Terraform deployment for IronSecureDoc?
The command `terraform init` initializes the Terraform deployment for IronSecureDoc, downloading the necessary Azure provider.
How can I verify the deployment of the IronSecureDoc container?
You can verify the deployment by running `terraform output` to obtain the public IP or FQDN and using tools like Postman or `curl` to execute a ping, expecting a `pong` response.
What is the process to destroy the IronSecureDoc resources on Azure?
To destroy the resources, create a destroy execution plan with `terraform plan -destroy` and then apply it using `terraform apply` to remove IronSecureDoc resources from Azure.
Can I specify the tag of the IronSecureDoc Docker image during deployment?
Yes, you can specify the tag of the IronSecureDoc Docker image by setting the `image_tag` variable in the `variables.tf` file, using either `latest` or a specific version number.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.