Over-ride if files already exists

Mansi Gusain 165 Reputation points
2024-12-19T11:22:40.42+00:00

User's image

Hi, I am using terraform to upload my local file into azure.

  1. I create a file locally,
  2. I pass the file to the storage account with a name "lc.yaml",
  3. The thing is everytime I will create the yaml file its name will be - lc.yaml,
  4. And this file has to be uploaded to the same file share with the same name even after some changes are made.
  5. So, the question is - is there a way I can have this overwrite if files already exist and upload the file with some alterations but same name?
       ## lc.yaml
       resource "azurerm_storage_share_file" "lc" {
         name             = "lc.yaml"
         storage_share_id = azurerm_storage_share.storage_share_app.id
         source           = local_sensitive_file.lc_config.filename
         depends_on       = [local_sensitive_file.lc_config]
       }
    
    So, this the setup, whenever I make changes to the original file, I have a mechanism to upload it to the file share and the condition is that it has to be using the name- lc.yaml only. Is there a way that I can have upload using override, in this config only and then always get the new version only. As the file is not being uploaded due to same name in the file share. Is there some way.
Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,329 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,290 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.