heat bad request port id not found

asked 2014-06-17 08:07:46 -0500

sudarshan gravatar image

i am trying harestarter with heat template yml.

i get the below error BadRequest: Port id d394f81c-10ed-4708-8634-f59aa416f257 could not be found. (HTTP 400) (Request-ID: req-b406ab1b-868b-4f31-ab66-eca9454a39ed)

stack creates the template then as soon the instance is deleted it tries to create new instance but it searches for the same port which was created at first.

Heat template is as below. Help me on how resolve this error.

heat_template_version: 2013-05-23

description: >
  HEAT template for my service

resources:
  #wait_handle:
    #type: OS::Heat::UpdateWaitConditionHandle
    #type: AWS::CloudFormation::WaitConditionHandle

  catalog:
    type: OS::Nova::Server
    properties:
      name: catalog
      image: "rhel_http"
      flavor: "m1.medium"
      key_name: "key2"
      networks:
        - port: { get_resource: catalog_port }
      user_data:
        str_replace:
          template: |
            #!/bin/bash -v
            # configure cfn
            mkdir /etc/cfn
            cat <<EOF > /etc/cfn/cfn-credentials
            AWSAccessKeyId=AWS_KEY
            AWSSecretKey=AWS_SECRET
            EOF
            chmod 000400 /etc/cfn/cfn-credentials
            cat <<EOF > /etc/cfn/cfn-hup.conf
            [main]
            stack=STACK_NAME
            credential-file=/etc/cfn/cfn-credentials 
            region='nova'
            interval=60
            EOF
            cat <<EOF > /tmp/cfn-hup-crontab.txt
            * * * * * /opt/aws/bin/cfn-hup -f
            * * * * * /opt/aws/bin/cfn-push-stats --watch HEARTBEATFAILUREALARM --heartbeat
            EOF
            chmod 000600 /etc/cfn/cfn-credentials
            # install cfn-hup crontab
            crontab /tmp/cfn-hup-crontab.txt
            reboot
          params:
            AWS_KEY: { get_resource: WebServerKeys }
            AWS_SECRET: { get_attr: [WebServerKeys, SecretAccessKey ] }
            STACK_NAME: { get_param: 'OS::stack_name' }
            HEARTBEATFAILUREALARM: { get_resource: HeartbeatFailureAlarm }

  catalog_port:
    type: OS::Neutron::Port
    properties:
      network_id: "2160b8de-2f28-4332-bad5-1a2a5bbba6f8"
      fixed_ips:
        - subnet_id: "83f4a81f-2875-4078-8c5a-a09c5efe0a02"

  heatproxy:
    type: AWS::IAM::User

  WebServerKeys:
    type: AWS::IAM::AccessKey
    depends_on: heatproxy
    properties:
      UserName: { get_resource: heatproxy }

   HeartbeatFailureAlarm:
    type: OS::Heat::CWLiteAlarm
     properties:
      AlarmActions: 
      - { get_resource: restart }
      AlarmDescription: Restart the Instance if we miss a heartbeat
      ComparisonOperator: LessThanThreshold
      EvaluationPeriods: '1'
      MetricName: Heartbeat
      #Namespace: system/linux
      Period: '60'
      Statistic: SampleCount
      Threshold: '1'

  catalog_floating_ip:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network_id: "3dcfc74c-3913-48ca-acae-789a022b7783"
      port_id: { get_resource: catalog_port }

  restart:
    type: OS::Heat::HARestarter
    properties:
      InstanceId: { get_resource: catalog }

outputs:
  catalog_private_ip:
    description: IP address of catalog in private network
    value: { get_attr: [ catalog, first_address ] }
  catalog_public_ip:
    description: Floating IP address of catalog in public network
    value: { get_attr: [ catalog_floating_ip, floating_ip_address ] }
edit retag flag offensive close merge delete