diff --git a/meta/io.murano.lib.networks.Neutron/Classes/NewNetwork.yaml b/meta/io.murano.lib.networks.Neutron/Classes/NewNetwork.yaml index 715b783e..3c124dcf 100644 --- a/meta/io.murano.lib.networks.Neutron/Classes/NewNetwork.yaml +++ b/meta/io.murano.lib.networks.Neutron/Classes/NewNetwork.yaml @@ -61,18 +61,19 @@ Workflow: - $.ensureNetworkConfigured() - $portname: $instance.name + '-port-to-' + $.id() - $template: - Resources: + heat_template_version: '2013-05-23' + resources: $portname: - Type: 'OS::Neutron::Port' - Properties: - network_id: {Ref: $.net_res_name} - fixed_ips: [{subnet_id: {Ref: $.subnet_res_name}}] + type: 'OS::Neutron::Port' + properties: + network_id: { get_resource: $.net_res_name } + fixed_ips: [{ subnet_id: { get_resource: $.subnet_res_name } }] security_groups: - - Ref: $securityGroupName + - get_resource: $securityGroupName $instance.name: - Properties: - NetworkInterfaces: - - Ref: $portname + properties: + networks: + - port: { get_resource: $portname } - $.environment.stack.updateTemplate($template) - If: $assignFloatingIp @@ -82,25 +83,23 @@ Workflow: Then: - $fip_name: $instance.name + '-FloatingIP-' + $.id() - $template: - Resources: + resources: $fip_name: - Type: 'OS::Neutron::FloatingIP' - Properties: + type: 'OS::Neutron::FloatingIP' + properties: floating_network_id: $extNetId $instance.name + '-FloatingIpAssoc-' + $.id(): - Type: 'OS::Neutron::FloatingIPAssociation' - Properties: + type: 'OS::Neutron::FloatingIPAssociation' + properties: floatingip_id: - Ref: $fip_name + get_resource: $fip_name port_id: - Ref: $portname - Outputs: + get_resource: $portname + outputs: $instance.name + '-FloatingIPaddress': - Value: - Fn::GetAtt: - - $fip_name - - floating_ip_address - Description: Floating IP assigned + value: + get_attr: [$fip_name, floating_ip_address] + description: Floating IP assigned - $.environment.stack.updateTemplate($template) ensureNetworkConfigured: @@ -132,33 +131,36 @@ Workflow: createNetwork: Body: - $template: - Resources: + heat_template_version: '2013-05-23' + resources: $.net_res_name: - Type: 'OS::Neutron::Net' - Properties: + type: 'OS::Neutron::Net' + properties: name: $.name - $.environment.stack.updateTemplate($template) createSubnet: Body: - $template: - Resources: + heat_template_version: '2013-05-23' + resources: $.subnet_res_name: - Type: 'OS::Neutron::Subnet' - Properties: - network_id: {Ref: $.net_res_name} + type: 'OS::Neutron::Subnet' + properties: + network_id: { get_resource: $.net_res_name } ip_version: 4 - dns_nameservers: [$.dnsNameserver] + dns_nameservers: [ $.dnsNameserver ] cidr: $.subnetCidr - $.environment.stack.updateTemplate($template) createRouterInterface: Body: - $template: - Resources: + heat_template_version: '2013-05-23' + resources: $.name + '-ri-' + $.id(): - Type: 'OS::Neutron::RouterInterface' - Properties: + type: 'OS::Neutron::RouterInterface' + properties: router_id: $.externalRouterId - subnet_id: {Ref: $.subnet_res_name} + subnet_id: { get_resource: $.subnet_res_name } - $.environment.stack.updateTemplate($template) diff --git a/meta/io.murano/Classes/SecurityGroupManager.yaml b/meta/io.murano/Classes/SecurityGroupManager.yaml index 5256ea28..fc389dfd 100644 --- a/meta/io.murano/Classes/SecurityGroupManager.yaml +++ b/meta/io.murano/Classes/SecurityGroupManager.yaml @@ -36,10 +36,11 @@ Workflow: - $stack: $.environment.stack - $template: - Resources: + heat_template_version: '2013-05-23' + resources: $groupName: - Type: 'OS::Neutron::SecurityGroup' - Properties: + type: 'OS::Neutron::SecurityGroup' + properties: description: format('Composite security group of Murano environment {0}', $.environment.name) rules: - port_range_min: null @@ -56,10 +57,10 @@ Workflow: )) - $template: - Resources: + resources: $groupName: - Type: 'OS::Neutron::SecurityGroup' - Properties: + type: 'OS::Neutron::SecurityGroup' + properties: rules: $ingress - $.environment.stack.updateTemplate($template) diff --git a/meta/io.murano/Classes/resources/Instance.yaml b/meta/io.murano/Classes/resources/Instance.yaml index 0526cc5d..64a1260f 100644 --- a/meta/io.murano/Classes/resources/Instance.yaml +++ b/meta/io.murano/Classes/resources/Instance.yaml @@ -69,20 +69,22 @@ Workflow: - $userData: $.prepareUserData() - $template: - Resources: + heat_template_version: '2013-05-23' + resources: $.name: - Type: 'AWS::EC2::Instance' - Properties: - InstanceType: $.flavor - ImageId: $.image - UserData: $userData - KeyName: $.keyname + type: 'OS::Nova::Server' + properties: + flavor: $.flavor + image: $.image + user_data: $userData + key_name: $.keyname - Outputs: + outputs: format('{0}-PublicIp', $.name): - Value: - - Fn::GetAtt: [$.name, PublicIp] + description: format('Public IP assigned to {0} instance', $.name) + value: + get_attr: [$.name, PublicIp] - $.environment.stack.updateTemplate($template) - $.environment.stack.push() - $outputs: $.environment.stack.output() diff --git a/muranoapi/engine/system/heat_stack.py b/muranoapi/engine/system/heat_stack.py index 0b115ea0..c870f129 100644 --- a/muranoapi/engine/system/heat_stack.py +++ b/muranoapi/engine/system/heat_stack.py @@ -165,7 +165,9 @@ class HeatStack(murano_object.MuranoObject): current_status = self._get_status() if current_status == 'NOT_FOUND': - if self._template.get('Resources'): + # For now, allow older CFN style templates as well, but this + # should be removed to avoid mixing them + if 'resources' in self._template or 'Resources' in self._template: self._heat_client.stacks.create( stack_name=self._name, parameters=self._parameters, @@ -175,7 +177,9 @@ class HeatStack(murano_object.MuranoObject): self._wait_state( lambda status: status == 'CREATE_COMPLETE') else: - if self._template.get('Resources'): + # For now, allow older CFN style templates as well, but this + # should be removed to avoid mixing them + if 'resources' in self._template or 'Resources' in self._template: self._heat_client.stacks.update( stack_id=self._name, parameters=self._parameters,