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

invalid error while creating vpc #15155

Closed
dattatrayakumbhar opened this issue Jun 7, 2017 · 1 comment · Fixed by #15158
Closed

invalid error while creating vpc #15155

dattatrayakumbhar opened this issue Jun 7, 2017 · 1 comment · Fixed by #15158

Comments

@dattatrayakumbhar
Copy link

Terraform Version

Terraform v0.9.6

Terraform Configuration Files

[root@dathost terraform1]# main.tf
resource "aws_vpc" "mod" {
cidr_block = "20.0.0.0/16"
tags = "${merge(var.tags, map("Name", format("%s", var.name)))}"
}

[root@dathost terraform1]# variable.tf
variable "name" {}
variable "tags" {
description = "A map of tags to add to all resources"
default = {}
}

[root@dathost terraform1]# output.tf
output "vpc_id" {
value = "${aws_vpc.mod.id}"
}

  1. First terraform apply gave cidr as 0.0.0.0/0 which said 0.0.0.0/0 cidr is invalid which is expected.
    [root@dathost terraform1]# terraform apply
    var.name
    Enter a value: datta

aws_vpc.mod: Creating...
assign_generated_ipv6_cidr_block: "" => "false"
cidr_block: "" => "0.0.0.0/0"
default_network_acl_id: "" => ""
default_route_table_id: "" => ""
default_security_group_id: "" => ""
dhcp_options_id: "" => ""
enable_classiclink: "" => ""
enable_dns_hostnames: "" => ""
enable_dns_support: "" => "true"
instance_tenancy: "" => ""
ipv6_association_id: "" => ""
ipv6_cidr_block: "" => ""
main_route_table_id: "" => ""
tags.%: "" => "1"
tags.Name: "" => "datta"
Error applying plan:

1 error(s) occurred:

  • aws_vpc.mod: 1 error(s) occurred:

  • aws_vpc.mod: Error creating VPC: InvalidVpc.Range: The CIDR '0.0.0.0/0' is invalid.
    status code: 400, request id: 8f2f8642-14bc-4071-96b1-04a19d6a4634

  1. Second time cidr was 20.0.0.0/0 which also invalid only but error which we got is expected cidr is "0.0.0.0/0" which is also not valid as per config: bundle metadata requires global constraints #1.

[root@dathost terraform1]# terraform plan
var.name
Enter a value: datta

1 error(s) occurred:

  • aws_vpc.mod: "cidr_block" must contain a valid network CIDR, expected "0.0.0.0/0", got "20.0.0.0/0"

Expected Behavior

Expected error in #2 would be like * aws_vpc.mod: "cidr_block" must contain a valid network CIDR, expected "x.0.0.0/y", got "20.0.0.0/0"
Or instead of x.0.0.0/y we could provide any valid cidr like "10.0.0.0/8" or "10.0.0.0/16"
If 0.0.0.0/0 is invalid , why shold we show it in warning.

Actual Behavior

  • aws_vpc.mod: "cidr_block" must contain a valid network CIDR, expected "0.0.0.0/0", got "20.0.0.0/0"

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan when cidr is "0.0.0.0/0"
  2. terraform plan when cidr is "20.0.0.0/0"
@ghost
Copy link

ghost commented Apr 11, 2020

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant