DataSunrise is sponsoring AWS re:Invent 2024 in Las Vegas, please visit us in DataSunrise's booth #2158

Azure Cloud: DataSunrise Configuration with OpenTOFU

Azure Cloud: DataSunrise Configuration with OpenTOFU

Deploying DataSunrise products in the cloud can be a complex process. However, using OpenTOFU makes it much easier to configure DataSunrise cloud deployment on Microsoft Azure and other cloud platforms. In this article, we’ll cover the basics of using OpenTOFU to deploy DataSunrise on Azure.

What is OpenTOFU?

It is an open source fork of the popular infrastructure-as-code (IaC) tool Terraform. As a replacement for Terraform, it enables the definition and provisioning of cloud infrastructure through a declarative configuration language.

It forked from Terraform 1.5.6 in 2021 and maintains a high degree of compatibility with standard Terraform configurations. You can use most Terraform scripts with OpenTOFU with little to no modification needed.

Obtaining Scripts from DataSunrise

To simplify configuring DataSunrise products on cloud platforms like Azure, DataSunrise provides ready-to-use Terraform/OpenTOFU scripts. These scripts handle the complex setup process for you.

To obtain the scripts, download them from the DataSunrise GitHub repository using the link above. For further details on the appropriate scripts for your deployment, reach out to your DataSunrise representative or contact DataSunrise support.

Cloud Service Providers and Resources

In OpenTOFU, a cloud service provider refers to the specific cloud platform you are using, such as Microsoft Azure, Amazon Web Services (AWS), or Google Cloud Platform (GCP). Each provider can configure and manage its own set of resources.

A resource in you script represents a component of your infrastructure, such as a virtual machine, database, or network. The OpenTOFU configuration files define resources using a specific syntax for each cloud provider.

There is a Public Registry containing the providers. Every OpenTOFU provider in this list has a JSON file that connects the host OS with the zip file. It also contains the provider binary download link. The registry entry for Azure provider might look like the following (truncated for clarity):

{
  "versions": [
    {
      "version": "1.13.1",
      "protocols": [
        "5.0"
      ],
      "shasums_url": "https://github.com/Azure/…-azapi_1.13.1_SHA256SUMS",
      "shasums_signature_url": "https://github.com/Azure/…-azapi_1.13.1_SHA256SUMS.sig",
      "targets": [
        {
          "os": "darwin",
          "arch": "amd64",
          "filename": "terraform-provider-azapi_1.13.1_darwin_amd64.zip",
          "download_url": "https://github.com/Azure/terraform-...-azapi_1.13.1_darwin_amd64.zip",
          "shasum": "652c5…0a67"
        },
…

Here, the ‘terraform-provider-azapi_1.13.1_darwin_amd64.zip’ file contains the provider binary for macOS (Darwin) with AMD64 (64-bit) architecture. You may note that there are Terraform providers by Azure located on GitHub. We can use them because of OpenTOFU’s compatibility with Terraform.

When you run the ‘tofu init’ console command with some provider configuration in the ‘main.tf’ ‘required_providers’ and ‘provider’ sections, OpenTOFU will identify your current operating system and download the appropriate zip file containing the pre-compiled provider binary.

OpenTOFU uses its own registry to determine a provider by its name from the required_providers section. It will then extract the binary from the zip file and use it to interact with the Azure API. This process works in the folder where the OpenTOFU ‘init’ command runs.

When using OpenTOFU scripts provided by DataSunrise, you don’t need to configure resources manually. You just have to adjust settings for security and other details for your Azure account. This includes things like the number of virtual machines for high availability, which can impact costs.

Configuring DataSunrise in Azure with OpenTOFU

The DataSunrise Terraform/OpenTOFU scripts streamline the deployment process on Azure. Applying these scripts follows the same general process as using any other Terraform or OpenTOFU script for Azure configuration.

Before running the scripts, ensure you have the following prerequisites:

  • An active Azure subscription
  • The Azure CLI installed on your local machine
  • Sufficient permissions to create and manage resources in your Azure subscription
  • OpenTOFU CLI installed.

The final configuration of the DataSunrise in Azure is as shown on the figure below:

Authenticating with Azure

To allow OpenTOFU to interact with your Azure subscription, you need to authenticate using the Azure CLI.

For this we recommend creating environment variables. The script lists them and they can change slightly, but we list them here for clarity.

Set ARM_CLIENT_ID="SET-CLIENT-KEY-HERE"
Set ARM_CLIENT_SECRET="SET-CLIENT-SECRET-HERE"
Set ARM_SUBSCRIPTION_ID="SET-SUBSCRIPTION-ID-HERE"
Set ARM_TENANT_ID="SET-TENANT-ID-HERE"

For detailed information on Azure Authentication we recommend reading the Microsoft document on this topic. It mentions several other important points like Service Principal and providing the credentials in the OpenTOFU configuration file.

Editing Terraform.tfvars File

To inform OpenTOFU on the cloud infrastructure parameters you need to edit the Terraform.tfvars file. The file itself contains several well-commented parameters. Many of them have default values, so you may not need to change them when working on the trial cloud setup.

Applying the Scripts

The OpenTOFU CLI is well documented and the documentation is located on the OpenTOFU website.

With the prerequisites in place and the necessary OpenTOFU scripts obtained from DataSunrise, you’re ready to apply the configuration and deploy DataSunrise on Azure.

First, navigate to the directory where you have saved the OpenTOFU scripts. Then, initialize the OpenTOFU working directory:

tofu init

This command downloads the required provider plugins and initializes the OpenTOFU state.

Next, create an execution plan:

tofu plan

The plan command shows you what actions IaC engine will take based on your configuration files. Review the plan output to ensure it aligns with your expectations.

If the plan looks good, apply the configuration:

tofu apply

OpenTOFU will prompt you to confirm the application. Type “yes” and press Enter to proceed.

OpenTOFU will now begin creating the necessary resources on Azure based on the DataSunrise deployment scripts. This process may take several minutes to complete.

Once the apply command finishes successfully, your DataSunrise deployment on Azure will be ready to use. The output will provide important details such as the URLs or IP addresses for accessing the DataSunrise components.

Troubleshooting

After the ‘apply’ command you should be able to see all the new resources in the resource group. The script sets the group name according to the ‘prefix’ parameter in the terraform.tfvars file (the first of all the parameters).

You can always destroy all the configuration made by the script, using the ‘tofu destroy’ command. It removes all the configuration made if you only intended to use it for development purposes.

Conclusion

Deploying DataSunrise products on cloud platforms like Microsoft Azure can be greatly simplified by using OpenTOFU and the ready-made scripts provided by DataSunrise.

By leveraging OpenTOFU’s declarative configuration language and the DataSunrise deployment scripts, you can quickly and easily set up DataSunrise in your Azure environment. This allows you to focus on using DataSunrise’s features to secure and monitor your data, rather than worrying about the intricacies of manual deployment.

Remember to reach out to DataSunrise to request an online demo or obtain the necessary OpenTOFU scripts for your specific deployment needs. With these scripts and the power of OpenTOFU, deploying DataSunrise on Azure becomes a straightforward and efficient process.

Next

PostgreSQL Authentication

PostgreSQL Authentication

Learn More

Need Our Support Team Help?

Our experts will be glad to answer your questions.

General information:
[email protected]
Customer Service and Technical Support:
support.datasunrise.com
Partnership and Alliance Inquiries:
[email protected]