We become indebted to.
To build an Azure environment,
I’m trying to build it with Terraform 12 grammar.
A grammar check with “terraform validate” using the files that constructed the environment a year ago
I was getting a lot of errors.
Since the version of Terrraform has changed from the last time I built the environment, it did not seem to mesh with the latest version.
We plan to hand over the environment on the 24th,
I want some clear solution by the 23rd at the latest.
We apologize for the inconvenience, but thank you for your cooperation.
–procedure–
(1) Support based on the file that built the environment last time.
When I checked the grammar with “terraform validate” for the first time,
“Error: “features”: required field is not set” error.
When I checked it, I found that the description of “features{}” was necessary, so
Described in Provider.tf file as follows.
provider “azurerm” {
subscription_id = “{var.subscription_id}"
client_id = "{var.client_id}”
client_secret = “{var.client_secret}"
tenant_id = "{var.tenant_id}”
features{}
}
(2) After that, when “terraform validate” was performed again, several errors were output.
――error message―
terraform validate
Warning: Interpolation-only expressions are deprecated
on core.tf line 3, in resource “azurerm_availability_set” “avset-core”:
3: location = “${var.location}”
Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the “${ sequence from the start and the }”
sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.
(and 133 more similar warnings elsewhere)
Warning: “address_prefix”: [DEPRECATED] Use the address_prefixes
property instead.
on core.tf line 17, in resource “azurerm_subnet” “sbnt-core”:
17: resource “azurerm_subnet” “sbnt-core” {
Error: Missing required argument
on database.tf line 3, in resource “azurerm_mysql_server” “db_mysql”:
3: resource “azurerm_mysql_server” “db_mysql” {
The argument “sku_name” is required, but no definition was found.
Error: Unsupported argument
on database.tf line 8, in resource “azurerm_mysql_server” “db_mysql”:
8: sku = {
An argument named “sku” is not expected here.
Error: Unsupported argument
on storage.tf line 17, in resource “azurerm_storage_share” “storeshare”:
17: resource_group_name = “${var.rg_name}”
An argument named “resource_group_name” is not expected here.
Error: Unsupported argument
on web01vm.tf line 7, in resource “azurerm_network_interface” “web01-network”:
7: network_security_group_id = “${azurerm_network_security_group.web_server_nsg.id}”
An argument named “network_security_group_id” is not expected here.
Error: Unsupported argument
on web02vm.tf line 7, in resource “azurerm_network_interface” “web02-network”:
7: network_security_group_id = “${azurerm_network_security_group.web_server_nsg.id}”
An argument named “network_security_group_id” is not expected here.