heat_template_version: rocky
parameters:
  image:
    type: string
    default: unused
  flavor:
    type: string
    default: unused
  key_name:
    type: string
    default: unused
    description: Name of keypair to assign to servers
  security_groups:
    type: json
    default: []
  # Require this so we can validate the parent passes the
  # correct value
  user_data_format:
    type: string
  user_data:
    type: string
    default: ''
  name:
    type: string
    default: 'deployed-server'
  image_update_policy:
    type: string
    default: ''
  networks:
    type: comma_delimited_list
    default: ''
  metadata:
    type: json
    default: {}
  software_config_transport:
    default: POLL_SERVER_CFN
    type: string
  scheduler_hints:
    type: json
    description: Optional scheduler hints to pass to nova
    default: {}
  UpgradeInitCommand:
    type: string
    description: |
      Command or script snippet to run on all overcloud nodes to
      initialize the upgrade process. E.g. a repository switch.
    default: ''
  UpgradeInitCommonCommand:
    type: string
    description: |
      Common commands required by the upgrades process. This should not
      normally be modified by the operator and is set and unset in the
      major-upgrade-composable-steps.yaml and major-upgrade-converge.yaml
      environment files.
    default: ''
  ControlPlaneSubnet:
    default: ctlplane-subnet
    description: The name of the undercloud Neutron control plane subnet
    type: string

resources:
  deployed-server:
    type: OS::Heat::DeployedServer
    properties:
      name: {get_param: name}
      software_config_transport: {get_param: software_config_transport}

  ControlPlanePort:
    type: OS::TripleO::DeployedServer::ControlPlanePort
    properties:
      network: ctlplane
      fixed_ips: [{subnet: {get_param: ControlPlaneSubnet}}]
      name:
        list_join:
          - '-'
          - - {get_param: name}
            - ctlplane
      replacement_policy: AUTO

outputs:
  OS::stack_id:
    value: {get_resource: deployed-server}
  networks:
    value:
      ctlplane:
        - {get_attr: [ControlPlanePort, fixed_ips, 0, ip_address]}
  addresses:
    value:
      ctlplane:
        - subnets: {get_attr: [ControlPlanePort, subnets]}
  name:
    value: {get_param: name}
  os_collect_config:
    value: {get_attr: [deployed-server, os_collect_config]}
