QT-DevOps / AWSIssues

Issues with AWS
Apache License 2.0
3 stars 26 forks source link

Cloudformatiion issue #33

Closed amit2793 closed 5 years ago

amit2793 commented 5 years ago

{ "AWSTemplateFormatVersion": "2010-09-09", "Description" : "Simple network", "Parameters" :{

    "vpccidrblock" :{
        "Description" : "CIDR Block for VPC",
        "Type" : "String",
        "Default" : "10.0.0.0/16"
    },

        "subnet1cidr": {
            "Description": "Subnet 1 CIDR",
            "Type" :"String",
            "Default" :"10.0.0.0/24"
        },
        "subnet2cidr": {
            "Description": "Subnet 2 CIDR",
            "Type" :"String",
            "Default":"10.0.1.0/24"
        },
        "subnet3cidr": {
            "Description": "Subnet 3 CIDR",
            "Type" :"String",
            "Default":"10.0.2.0/24"
        },
        "subnet4cidr": {
            "Description": "Subnet 4 CIDR",
            "Type" :"String",
            "Default":"10.0.3.0/24"
        }
},

"Resources" : {
    "myvpc": {
        "Type" : "AWS::EC2::VPC",
        "Properties" : {
            "CidrBlock" : { "Ref": "vpccidrblock" }
        }
    }
},

"subnet1": {
    "Type": "AWS::EC2::Subnet",
    "Properties": {
      "AvailabilityZone": "us-west-2a",
      "VpcId": { "Ref": "myvpc" },
      "CidrBlock": {"Ref":"subnet1cidr"}
    }
  },

  "subnet2": {
    "Type": "AWS::EC2::Subnet",
    "Properties": {
      "AvailabilityZone": "us-west-2b",
      "VpcId": { "Ref": "myvpc" },
      "CidrBlock": {"Ref":"subnet2cidr"}
    }
    },
    "subnet3": {
        "Type": "AWS::EC2::Subnet",
        "Properties": {
          "AvailabilityZone": "us-west-2c",
          "VpcId": { "Ref": "myvpc" },
          "CidrBlock": {"Ref":"subnet3cidr"}
        }
    },

    "subnet4" :{ 
        "Type": "AWS::EC2::Subnet",
        "Properties" :{
            "AvailabilityZone": "us-west-2a",
            "VpcId" : { "Ref" : "myvpc"} ,
            "CidrBlock": {"Ref":"subnet4cidr"}
        }
    },

    "mysecuritygroup" : {
        "Type" : "AWS::EC2::SecurityGroup",
        "Properties" : {
          "GroupName": "AllowSSH",
          "GroupDescription" : "This Group is for allowing ssh",
          "VpcId" : {"Ref":"myvpc"}
        }
    }

}

Error while uploading file Template validation error: Invalid template property or properties [mysecuritygroup, subnet1, subnet2, subnet3, subnet4]

please suggest.

amit2793 commented 5 years ago

issue resolved, re-written the whole code

amit2793 commented 5 years ago

i have to rewrite the code from start, everytime i make new entry in template , it shows this error:"Error while uploading file Template validation error: Invalid template property or properties [mysecuritygroup, subnet1, subnet2, subnet3, subnet4]

kindly help...

{ "AWSTemplateFormatVersion": "2010-09-09", "Description" : "Complex network", "Parameters" :{

    "vpccidrblock":{
        "Description" : "CIDR Block for VPC",
        "Type": "String",
        "Default": "10.0.0.0/16"
    },
        "subnet1cidr": {
            "Description": "Subnet 1 CIDR",
            "Type": "String",
            "Default":"10.0.0.0/24"
        },
        "subnet2cidr": {
            "Description": "Subnet 1 CIDR",
            "Type": "String",
            "Default":"10.0.1.0/24"
        },
        "subnet3cidr": {
            "Description": "Subnet 1 CIDR",
            "Type": "String",
            "Default": "10.0.2.0/24"
        },
        "subnet4cidr": {
            "Description": "Subnet 1 CIDR",
            "Type": "String",
            "Default": "10.0.3.0/24"
        }
    },

    "subnet1az" :{
        "Description": "az of subnet1",
        "Type": "AWS::EC2::AvailabilityZone::Name"
    },

    "subnet2az" :{
        "Description": "az of subnet2",
        "Type": "AWS::EC2::AvailabilityZone::Name"
    },

    "subnet3az" :{
        "Description": "az of subnet3",
        "Type": "AWS::EC2::AvailabilityZone::Name"
    },

    "subnet4az" :{
        "Description": "az of subnet4",
        "Type": "AWS::EC2::AvailabilityZone::Name"
    },

"Resources":{
    "myvpc": {
        "Type":"AWS::EC2::VPC",
        "Properties": {
            "CidrBlock" : {"Ref" : "vpccidrblock"}
        }
    },
      "subnet1":{
          "Type":"AWS::EC2::Subnet",
          "Properties":{
              "AvailabilityZone": {"Ref": "subnet1az" },
              "VpcId": { "Ref": "myvpc"},
              "CidrBlock":{"Ref": "subnet1cidr" }

            }
              },

              "subnet2": {
                "Type":"AWS::EC2::Subnet",
                "Properties":{
                    "AvailabilityZone": {"Ref": "subnet2az" },
                    "VpcId": { "Ref": "myvpc"},
                    "CidrBlock":{"Ref": "subnet2cidr" }

                  }
                    },

                    "subnet3":{
                        "Type":"AWS::EC2::Subnet",
                        "Properties":{
                            "AvailabilityZone": {"Ref": "subnet3az" },
                            "VpcId": { "Ref": "myvpc"},
                            "CidrBlock":{"Ref": "subnet3cidr" }

                          }
                            }, 

                            "subnet4":{
                                "Type":"AWS::EC2::Subnet",
                                "Properties":{
                                    "AvailabilityZone": {"Ref": "subnet4az" },
                                    "VpcId": { "Ref": "myvpc"},
                                    "CidrBlock":{"Ref": "subnet4cidr" }

                                  }
                                    }, 

                                "mySecuritygroup":{
                                    "Type":"AWS::EC2::SecurityGroup",
                                    "Properties":{
                                        "GroupName" : "AllowSSH",
                                        "GroupDescription": "This Group is for allowing ssh",
                                        "VpcId" : {"Ref" : "myvpc"}
                                    }
                                }                                                    
          }
      }