Open OSalamaPret opened 2 years ago
I fully support the request. In my project it's mandatory to rely on storage container policies. Hence the only workaround right now is to use null_resource
along with running az
command in local-exec
provisioner. Maybe there could be other alternatives. But it doesn't matter. New azurerm_storage_account_blob_container_policy
resource should definitely be added to the provideder.
And data source azurerm_storage_account_blob_container_sas
should be updated accordingly to choose whether to create standalone SAS token or based on specified azurerm_storage_account_blob_container_policy
resource.
Additional justification of the request
A stored access policy provides an additional level of control over service-level shared access signatures (SASs) on the server side. Establishing a stored access policy serves to group shared access signatures and to provide additional restrictions for signatures that are bound by the policy. You can use a stored access policy to change the start time, expiry time, or permissions for a signature. You can also use a stored access policy to revoke a signature after it has been issued.
ref. https://docs.microsoft.com/en-gb/rest/api/storageservices/define-stored-access-policy
I find this also very important for my current project. Also big on security, since it allows deletion of the policy negating the SAS URL in case of information leak.
Is there an existing issue for this?
Community Note
Description
When creating a SAS (Shared Access Signature) there is an option to associate with a stored access policy, which gives greater control over the SAS.
To set up the stored access policy on a container level requires calling Set Container ACL, which we do not currently seem to have a resource for in AzureRM.
azurerm_storage_data_lake_gen2_filesystem
andazurerm_storage_data_lake_gen2_path
have options to specify ACL directly on a file/folder, but it's not possible to use this to set container ACL/stored access policyazurerm_storage_container
does not offer any ACL control eitherI haven't got much experience working with azurerm but it appears we generally prefer embedding the ACL configuration resources within the main resource creation, in which case we'd have to modify both
azurerm_storage_data_lake_gen2_filesystem
andazurerm_storage_container
to support this.Worth noting you can only have 5 stored access policies on a container, so it feels it would be easier to manage & avoid quota errors if they're all defined together.
New or Affected Resource(s)/Data Source(s)
azurerm_storage_data_lake_gen2_filesystem
azurerm_storage_container
Potential Terraform Configuration
References
https://docs.microsoft.com/en-us/rest/api/storageservices/define-stored-access-policy https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-acl