问题原文
原帖链接 · Seffyroff · CC BY-SA 3.0
As part of an Azure ACI definition Terraform script, I'm creating an azurerm_storage_share which I want to then upload some files to, before mounting to my container.
As far as I can tell, the right way to access the share once created is via SMB. This rules out all the Terraform provisioners (except local-exec) which support only SSH or WinRM.
So I'm thinking the most efficient, maintainable way to do this is to local-exec to a script that runs azure-cli commands like az storage upload ... ? That way TF does what it does best (orchestration) and have az do config provisioning.
已采纳解答
原帖链接 · Shui shengbao · CC BY-SA 3.0
Yes, you are right. Terrafrom could not directly access to Azure File share and upload files to it.
Based on my knowledge, maybe you could store your files in a Linux VM and install Azure Cli 2.0 on it. Then you could write a script to upload files to Azure file share like below:
#!/bin/bash
# A simple Azure Storage example script
export AZURE_STORAGE_ACCOUNT=<storage_account_name>
export AZURE_STORAGE_ACCESS_KEY=<storage_account_key>
az storage file upload --share-name myshare --source ~/temp/samplefile.txt
More information about this please refer to this link.
Then you could SSH to this VM and execute this script on Terraform.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
