Skip to content
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

Cannot intiliaze 1-main-vnet #5

Open
agoncal opened this issue May 12, 2021 · 0 comments
Open

Cannot intiliaze 1-main-vnet #5

agoncal opened this issue May 12, 2021 · 0 comments

Comments

@agoncal
Copy link

agoncal commented May 12, 2021

I'm following the course and I've reached the first exercise 1-main-vnet . The Terraform version on Azure has evolved since the creation of the course:

$ terraform version
Terraform v0.15.1

After creating the main.tf file, I've tried initialize the project but got the following errors:

~/terraform/1-main-vnet$ terraform init
Initializing modules...
Downloading Azure/vnet/azurerm 1.2.0 for vnet-main...
- vnet-main in .terraform/modules/vnet-main
There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
╷
│ Warning: Version constraints inside provider configuration blocks are deprecated
│
│   on main.tf line 35, in provider "azurerm":
│   35:   version = "~> 1.0"
│
│ Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is now
│ deprecated and will be removed in a future version of Terraform. To silence this warning, move the provider version constraint
│ into the required_providers block.
╵

╷
│ Error: Invalid quoted type constraints
│
│   on .terraform/modules/vnet-main/variables.tf line 39, in variable "nsg_ids":
│   39:   type        = "map"
│
│ Terraform 0.11 and earlier required type constraints to be given in quotes, but that form is now deprecated and will be removed
│ in a future version of Terraform. Remove the quotes around "map" and write map(string) instead to explicitly indicate that the
│ map elements are strings.
╵

╷
│ Error: Invalid quoted type constraints
│
│   on .terraform/modules/vnet-main/variables.tf line 49, in variable "tags":
│   49:   type        = "map"
│
│ Terraform 0.11 and earlier required type constraints to be given in quotes, but that form is now deprecated and will be removed
│ in a future version of Terraform. Remove the quotes around "map" and write map(string) instead to explicitly indicate that the
│ map elements are strings.

As a workaround, the way to fix it is to go to 1-main-vnet/.terraform/modules/vnet-main, edit the variables.tf and change type = "map" with type = map(string):

variable "nsg_ids" {
  description = "A map of subnet name to Network Security Group IDs"
  type        = map(string)

  default = {
    subnet1 = "nsgid1"
    subnet3 = "nsgid3"
  }
}

variable "tags" {
  description = "The tags to associate with your network and subnets."
  type        = map(string)

  default = {
    tag1 = ""
    tag2 = ""
  }
}

See: terraform-google-modules/terraform-google-kubernetes-engine#358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant