-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_storage_account
- Support for min_tls_version
#7879
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @giotab Thanks for this PR!
I've taken a look through and left some comments inline, but this is mostly looking good to me 👍
azurerm/internal/services/storage/resource_arm_storage_account.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/storage/data_source_storage_account.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/storage/resource_arm_storage_account.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go
Show resolved
Hide resolved
azurerm/internal/services/storage/tests/resource_arm_storage_account_test.go
Outdated
Show resolved
Hide resolved
Hey @giotab === RUN TestAccAzureRMStorageAccount_writeLock
=== PAUSE TestAccAzureRMStorageAccount_writeLock
=== CONT TestAccAzureRMStorageAccount_writeLock
--- FAIL: TestAccAzureRMStorageAccount_writeLock (71.81s)
=== RUN TestAccAzureRMStorageAccount_minTLSVersion
=== PAUSE TestAccAzureRMStorageAccount_minTLSVersion
=== CONT TestAccAzureRMStorageAccount_minTLSVersion
--- FAIL: TestAccAzureRMStorageAccount_minTLSVersion (204.07s) Once that is addressed, we shall be ready to merge it 🚀 |
Turns out typos in the tests :)
|
azurerm_storage_account
- Support for min_tls_version
This has been released in version 2.22.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.22.0"
}
# ... other configuration ... |
Unfortunately, this PR produces changes in already existing infrastructure. Shouldnt this be optional? If i upgrade the provider from 2.21 to 2.22 it shows this as a needed change for every storage account. |
The PR should only produces changes in existing infrastructure if you manually updated the storage account to use a different min_tls_version before Terraform started being able to track it. It should be documented as a change that requires remediation of existing storage account resource definitions that were manually updated outside of Terraform though. |
Its a storage account that i imported i.e. it existed and was created in azure and was imported via the import command. And this is an example of the current plan output :
I dont want to apply these changes, since i dont know their effect, should i add this attribute to the ignore_changes or reimport the resource? Or is there a better way? PS: I dont see min_tls_version as an attribute in the azure resource explorer for any of the storage accounts. |
Honestly, I would re-import the resource so you are consistent w/ the provider. The provider should pull the min_tls_version of the storage account and put it in the state file. If you look in the Azure Portal for the storage account under Configuration, the option should appear there above "Access tier (default)" and below "Allow Blob public access". I haven't been able to find where that setting is surfaced through other clients (Azure CLI, PowerShell or Resource Explorer) yet. |
Unfortunatly, even after removing and importing the state of the storage account, min_tls_version is only written empty ( "min_tls_version": "",) and terraform plan still shows it as an addition |
I even tried to directly set the empty values into the state but as soon as the state refreshes, it gets emptied again. For now i will ignore changes to this attribute but that sounds like a strange behavior / bug |
Hi @SebastianAtWork Apologize to the impact. May I know whether you are using Azure Public or some other environment (e.g. Azure US Government)? If you are the latter case, then the issue is probably fixed by #8092. Otherwise, this might because of the API issue, assuming your storage account is created by a quite old API version, where the |
We´re on Azure Public. I dont know if the api is old, The storage account should have been created last year manually in the Portal and we imported them a few weeks ago into terraform. And then reimported it last week. Sounds like it should not happen with new azure storage accounts and theres not much i can do about the existing ones besides ignoring the change? (Or recreating them, which i cant do / would be too much work for such an attribute) |
@SebastianAtWork I just open a PR #8152 to fix this, thank you for your report! |
For those storage account created using old API version (at least 2018-02-01, before provider v1.29.0), the GET call of new API version will not return the `minimumTLSVersion` in response body. So those users will get a diff. This PR sets the default value for `min_tls_version` in case it is missing in response, using the same value as the default value defined in schema.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
set the
min_tls_version
when creating a storage account.This closes #7778, closes #7966.