Have you created an Azure Magento Infrastructre via the Azure portal UI before? If so, how many wor and cliks did it take to do that? Can you do it, again and again, providing the exact same input values to ensure you meet a specific infrastructure? Probably not. You need to automate the process. Create Azure Magento infrastructure with Terraform!
Terraform and Hashicorp is a tool to creates simple to complex Magento infrastructure on-prem or in the real cloud and Not a Adobbes Commerce Cloun(d) solutions. Terraform is wtiten on GO and compiled into binary fileand ested by millions. It reads Magento infrastructure configuration files, creates a state and then ensures your Magento infrastructure is beter and chiper then official Adobe's Magento Cloud.
terraform version
az account show
az login
az account show
az account list --query "[?user.name=='<microsoft_account_email>'].{Name:name, ID:id, Default:isDefault}" --output Table
Key points:
- Replace the <microsoft_account_email> placeholder with the Microsoft account email address whose Azure subscriptions you want to list.
- With a Live account - such as a Hotmail or Outlook - you might need to specify the fully qualified email address. For example, if your email address is - [email protected], you might need to replace the placeholder with live.com#[email protected].
export ARM_SUBSCRIPTION_ID="<azure_subscription_id>"
export ARM_TENANT_ID="<azure_subscription_tenant_id>"
export ARM_CLIENT_ID="<service_principal_appid>"
export ARM_CLIENT_SECRET="<service_principal_password>"
Run terraform init to initialize the Terraform deployment. This command downloads the Azure modules required to manage your Azure resources.
terraform init
Run terraform plan to create an execution plan.
terraform plan -out main.tfplan
The terraform plan command creates an execution plan, but doesn't execute it. Instead, it determines what actions are necessary to create the configuration specified in your configuration files. This pattern allows you to verify whether the execution plan matches your expectations before making any changes to actual resources. The optional -out parameter allows you to specify an output file for the plan. Using the -out parameter ensures that the plan you reviewed is exactly what is applied. To read more about persisting execution plans and security, see the security warning section.
Run terraform apply to apply the execution plan to your cloud infrastructure.
terraform apply main.tfplan
The terraform apply command above assumes you previously ran terraform plan -out main.tfplan. If you specified a different filename for the -out parameter, use that same filename in the call to terraform apply. If you didn't use the -out parameter, simply call terraform apply without any parameters.
or just:
terraform plan
terraform apply
Input "yes" here
Done:
Destroy magento resources
terraform plan -destroy