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

Encountering issues when creating a VPC and Firewall rules using the Terraform GCP blueprint. #542

Closed
rahul-tiple opened this issue Jan 24, 2024 · 2 comments
Labels
question Further information is requested Stale

Comments

@rahul-tiple
Copy link

TL;DR

When creating VPC and Firewall rules using "Terraform blueprints and modules for Google Cloud," the VPC is successfully created. However, when attempting to create the Firewall at the same time, an error occurs: "Network name already created." This error found because I am using the same source, "terraform-google-modules/network/google." Additionally, when using the source "terraform-google-modules/network/google//modules/firewall-rules," a version conflict error occurs.

How to set the default variables in the firewall_rules variable.tf file:

Expected behavior

https://github.com/terraform-google-modules/terraform-google-network/blob/master/main.tf

Observed behavior

Error: Invalid type specification
on .terraform/modules/firewall_rules/modules/firewall-rules/variables.tf line 32, in variable "rules":
32: description = optional(string, null)
Keyword "optional" is not a valid type constructor.

and

version conflict

Terraform Configuration

variable "rules" {
  description = "This is DEPRICATED and available for backward compatiblity. Use ingress_rules and egress_rules variables. List of custom rule definitions"
  type = list(object({
    name                    = string
    description             = optional(string, null)
    direction               = optional(string, "INGRESS")
    disabled                = optional(bool, null)
    priority                = optional(number, null)
    ranges                  = optional(list(string), [])
    source_tags             = optional(list(string))
    source_service_accounts = optional(list(string))
    target_tags             = optional(list(string))
    target_service_accounts = optional(list(string))

    allow = optional(list(object({
      protocol = string
      ports    = optional(list(string))
    })), [])
    deny = optional(list(object({
      protocol = string
      ports    = optional(list(string))
    })), [])
    log_config = optional(object({
      metadata = string
    }))
  }))
  default = [
    {
      name                    = "allow-ssh-ingress"
      description             = null
      direction               = "INGRESS"
      priority                = null
      destination_ranges      = ["10.0.0.0/8"]
      source_ranges           = ["0.0.0.0/0"]
      source_tags             = null
      source_service_accounts = null
      target_tags             = null
      target_service_accounts = null
      allow = [{
        protocol = "tcp"
        ports    = ["22"]
      }]
      deny = []
      log_config = {
          metadata = "INCLUDE_ALL_METADATA"
      }
    }
  ]
}

Terraform Version

Your version of Terraform is out of date! The latest version
is 1.7.0. You can update by downloading from https://www.terraform.io/downloads.html
Terraform v0.13.0

Additional information

Please explain how to use the Terraform GCP blueprint and set the default variables in the firewall_rules variable.tf file.

@rahul-tiple rahul-tiple added the bug Something isn't working label Jan 24, 2024
@imrannayer
Copy link
Collaborator

@rahul-tiple it seems like you are using older version of Terraform (0.13). Module support TF version 1.3+

https://github.com/terraform-google-modules/terraform-google-network?tab=readme-ov-file#compatibility

@imrannayer imrannayer added question Further information is requested and removed bug Something isn't working labels Feb 12, 2024
Copy link
Contributor

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Apr 12, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants