Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Create AutoScalingGroup in a single file

I'm trying to create an auto scaling but I'm having this error:

"Erro: ERROR: resources.autoscaling1<nested_stack>: : The Resource Type (vmteste) could not be found."

I know I can register the instance and the member of the balancer before creating auto scaling but I want to pass everything in a single file, is it possible?

>  heat_template_version: 2017-09-01  
> description: > 
>     Template stack gerado por ucloud input   resources: 
>     autoscaling1:
>       type: OS::Heat::AutoScalingGroup
>       properties:
>         max_size: 3
>         min_size: 1
>         cooldown: 5
>         desired_capacity: 1
>         resource: 
>           type: {get_resource: vmteste}
>           properties:
>             flavor: 1VCPU-1GBRAM
>             image: Ubuntu-18.04-x86_64
>             key_name: {get_resource: chav1}
>             pool_id: {get_resource: pool-balanceador1}
>             security_groups: {get_resource: sgteste}
>             metadata:
>               metering.server_group: {get_param: 'OS::stack_id'}
>     balanceador1:
>       type: OS::Neutron::LBaaS::LoadBalancer
>       properties:
>         name: BALANCEADOR1
>         vip_subnet: {get_resource: subnettoredeteste}
>     monitor-balanceador1:
>       type: OS::Neutron::LBaaS::HealthMonitor
>       properties:
>         delay: 5
>         max_retries: 3
>         timeout: 5
>         type: PING
>         pool: {get_resource: pool-balanceador1}
>     pool-balanceador1:
>       type: OS::Neutron::LBaaS::Pool
>       properties:
>         name: POOL-BALANCEADOR1
>         lb_algorithm: ROUND_ROBIN
>         protocol: TCP
>         listener: {get_resource: listerner-balanceador1}
>     listerner-balanceador1:
>       type: OS::Neutron::LBaaS::Listener
>       properties:
>         name: LISTERNER-BALANCEADOR1
>         protocol: TCP
>         protocol_port: 22
>         loadbalancer: {get_resource: balanceador1}
>     redeteste:
>       type: OS::Neutron::Net
>       properties: {name: REDETESTE}
>     subnettoredeteste:
>       type: OS::Neutron::Subnet
>       properties:
>         name: SUBNETTOREDETESTE
>         network: {get_resource: redeteste}
>         cidr: 172.19.158.128/25
>         dns_nameservers: [8.8.8.8, 8.8.4.4]
>         ip_version: 4
>     chav1:
>       type: OS::Nova::KeyPair
>       properties:  { name: CHAV1, public_key: -----BEGIN PUBLIC KEY-----
> MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJxGUDUmNJhgPMfspOvI9o0dSmAnscx4
> In8s+GykEJXpS6lxownW3s7fjJeK2El5Uiv2Jd/kYe1y0VncOmj9KRMCAwEAAQ==
> -----END PUBLIC KEY-----}
>     sgteste:
>       type: OS::Neutron::SecurityGroup
>       properties:
>         name: SGTESTE
>         rules:
>         - {port_range_max: 22, port_range_min: 22, protocol: tcp,
> remote_ip_prefix: 0.0.0.0/0}
>     policytoautoscaling11:
>       type: OS::Heat::ScalingPolicy
>       properties:
>         adjustment_type: change_in_capacity
>         auto_scaling_group_id: {get_resource: autoscaling1}
>         scaling_adjustment: 1
>         cooldown: 60
>     vmteste:
>       type: OS::Nova::Server
>       properties: 
>         name: VMTESTE
>         flavor: 1VCPU-1GBRAM
>         image: Ubuntu-18.04-x86_64
>         key_name: {get_resource: chav1}
>         security_groups:
>         - default
>         - {get_resource: sgteste}
>         networks:
>         - network: {get_resource: redeteste}
>     menbervm:
>       type: OS::Neutron::LBaaS::PoolMember
>       properties:
>         address: 172.19.158.129
>         admin_state_up: true
>         pool: {get_resource: pool-balanceador1}
>         protocol_port: 22
>         subnet: {get_resource: subnettoredeteste}
>         weight: 1