puphpet/puphpet

View on GitHub
src/PuphpetBundle/Resources/views/vagrantfile-aws/machine.html.twig

Summary

Maintainability
Test Coverage
{% set uniqid = uniqid ?? uniqid('machine_') %}
{% set idBase = "vagrantfile-vm-provider-aws-machines-#{uniqid}" %}
{% set nameBase = "vagrantfile[vm][provider][aws][machines][#{uniqid}]" %}

<div id="{{ idBasee }}" data-uniqid="{{ uniqid }}"
     class="tab-pane {{ active is defined and active ? 'active' }}">
    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-id">
            Internal Identifier
        </label>
        <input type="text" id="{{ idBase }}-id"
               name="{{ nameBase }}[id]"
               placeholder="aws1" class="form-control"
               value="{{ machine.id }}" />
        <div class="help-block">
            This is the ID used within the <code>Vagrantfile</code>. It is only used
            for your internal identification.
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-hostname">
            Hostname
        </label>
        <input type="text" id="{{ idBase }}-hostname"
               name="{{ nameBase }}[hostname]"
               placeholder="aws1.puphpet" class="form-control"
               value="{{ machine.hostname }}" />
        <div class="help-block">
            The hostname the machine should have.
            <a href="http://stackoverflow.com/a/3523068/446766"
               target="_blank">This answer lists all valid characters.</a>
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-keypair_name">
            EC2 Key Pair Name
        </label>
        <input type="text" id="{{ idBase }}-keypair_name"
               name="{{ nameBase }}[keypair_name]"
               placeholder="EC2 KEY PAIR NAME" class="form-control"
               value="{{ machine.keypair_name }}" />
        <div class="help-block">
            The Key Pair name from
            <a href="https://console.aws.amazon.com/ec2/v2/home?#KeyPairs:" target="_blank">here</a>.
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-private_key_path">
            Local Private Key Path
        </label>
        <input type="text" id="{{ idBase }}-private_key_path"
               name="{{ nameBase }}[private_key_path]"
               placeholder="~/.ssh/id_rsa" class="form-control"
               value="{{ machine.private_key_path }}" />
        <div class="help-block">
            <p>The EC2 server will not be accessible without your
                <span class="label label-info" data-toggle="help-text">
                    <i class="fa fa-ellipsis-h"></i></span>
                <span class="hidden">private/public key.</span>
            </p>
            <div class="hidden">
                <p>This corresponds to the "EC2 Key Pair Name".</p>

                <p><strong>It will not be accessible using username/password,
                        only private key!</strong></p>
            </div>
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-region">
            Datacenter Location
        </label>
        <select id="{{ idBase }}-region"
               name="{{ nameBase }}[region]"
               class="form-control select-tag">
            {% for key, region in regions %}
                <option value="{{ key }}"
                    {% if key == machine.region %}selected{% endif %}>{{ key }} - {{ region }}</option>
            {% endfor %}
        </select>
        <div class="help-block">
            Choose the one closest to you, or your target audience!
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-instance_type">
            Instance Size
        </label>
        <select id="{{ idBase }}-instance_type"
               name="{{ nameBase }}[instance_type]"
               class="form-control select-tag">
            {% for type, description in instance_types %}
                <option value="{{ type }}"
                    {% if type == machine.instance_type %}selected{% endif %}>{{ type }} - {{ description }}</option>
            {% endfor %}
        </select>
        <div class="help-block">
            <a href="http://aws.amazon.com/ec2/pricing/"
               target="_blank">Pricing information</a>.
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-ami">
            AMI
        </label>
        <input type="text" id="{{ idBase }}-ami"
               name="{{ nameBase }}[ami]"
               placeholder="AMI" class="form-control"
               value="{{ machine.ami }}" />
        <div class="help-block">
            <p>The AMI must be available to the region and size
                <span class="label label-info" data-toggle="help-text">
                    <i class="fa fa-ellipsis-h"></i></span>
                <span class="hidden">selected above.</span>
            </p>
            <div class="hidden">
                <p><strong>You</strong> are responsible for ensuring the AMI you select
                    is compatible with PuPHPet configs. Currently
                    Ubuntu 14.04, 16.04 and CentOS 6.x, 7.x are supported.
                </p>
            </div>
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-ssh_username">
            SSH Username
        </label>
        <input type="text" id="{{ idBase }}-ssh_username"
               name="{{ nameBase }}[ssh_username]"
               placeholder="AMI" class="form-control"
               value="{{ machine.ssh_username }}" />
        <div class="help-block">
            You must know what username your chosen AMI requires for initial boot up!
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-security_groups">
            EC2 Security Groups
        </label>
        <select id="{{ idBase }}-security_groups"
               name="{{ nameBase }}[security_groups][]"
               multiple class="form-control select-tags-editable">
            {% for group in machine.security_groups %}
                <option value="{{ group }}" selected>{{ group }}</option>
            {% endfor %}
        </select>
        <div class="help-block">
            Assign security groups to this instance.
            <a href="https://console.aws.amazon.com/ec2/home?#s=SecurityGroups" target="_blank">Get them here</a>.
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-subnet_id">
            VPC Subnet ID
        </label>
        <input type="text" id="{{ idBase }}-subnet_id"
               name="{{ nameBase }}[subnet_id]"
               placeholder="VPC Subnet ID" class="form-control"
               value="{{ machine.subnet_id }}" />
        <div class="help-block">
            The subnet to boot the instance into, for VPC.
            <a href="https://console.aws.amazon.com/vpc/home?#subnets:" target="_blank">Get them here</a>.
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-elastic_ip">
            Elastic IP Address
        </label>
        <input type="text" id="{{ idBase }}-elastic_ip"
               name="{{ nameBase }}[elastic_ip]"
               placeholder="Elastic IP" class="form-control"
               value="{{ machine.elastic_ip }}" />
        <div class="help-block">
            Assign an elastic IP address to this instance.
            <a href="https://console.aws.amazon.com/ec2/v2/home?Addresses#Addresses:sort=publicIp" target="_blank">Get them here</a>.
        </div>
    </div>

    <div class="clearfix"></div>
</div>