How to specify in terraform code to install always the latest version of azurerm

how to specify in terraform code to install always the latest version of azurerm resources.

It depends on the resource.

Normally goes like this: you query the available versions using a data source, e.g. azurerm_kubernetes_service_versions

You can then reference the latest version in your resource like so:

  version = data.azurerm_kubernetes_service_versions.current.latest_version

You need to be careful with this approach though. Every time a new version is available a new terraform plan will include an update to the resource unless you specifically tell it to ignore version changes.

1 Like