# Create an HTTPS Origin based on public IP for VoltMesh

**URL:** <https://community.f5.com/t/create-an-https-origin-based-on-public-ip-for-voltmesh/67361>\
**Category:** Community CodeShare\
**Tags:** devops, cloud, voltmesh\
**Created:** [October 18, 2021, 6:35pm UTC](https://community.f5.com/t/create-an-https-origin-based-on-public-ip-for-voltmesh/67361 "2021-10-18T18:35:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philippe\_Veys](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/philippe_veys/32/11328_2.png) [@Philippe\_Veys](https://community.f5.com/u/Philippe_Veys)\
**Post date:** [October 18, 2021, 6:35pm UTC](https://community.f5.com/t/create-an-https-origin-based-on-public-ip-for-voltmesh/67361/1 "2021-10-18T18:35:16Z")

</div>

**Problem this snippet solves:**

How to create an HTTPS Origin that could be used in a VoltMesh HTTP or HTTPS Load-Balancer.

This Origin is based on a public IP.

**How to use this snippet:**

Pre-requirements:

- Have a Volterra API Certificate. Please see this page for the API Certificate generation:&nbsp;[https://volterra.io/docs/how-to/user-mgmt/credentials](https://volterra.io/docs/how-to/user-mgmt/credentials)
- Extract the certificate and the key from the .p12:

```ql-syntax
openssl pkcs12 -info -in certificate.p12 -out private_key.key -nodes -nocerts
    openssl pkcs12 -info -in certificate.p12 -out certificate.cert -nokeys

```

- Create a variables.tf Terraform variables file:

```ql-syntax
variable "api_cert" {
            type = string
            default = "/<full path to>/certificate.cert"
        }
        
        variable "api_key" {
          type = string
          default = "/<full path to>/private_key.key"
        }
        
        variable "api_url" {
            type = string
            default = "https://<tenant_name>.console.ves.volterra.io/api"
        }

```

- Create a main.tf Terraform file:

```ql-syntax
terraform {
          required_version = ">= 0.12.9, != 0.13.0"
        
          required_providers {
            volterra = {
              source = "volterraedge/volterra"
              version = ">=0.0.6"
            }
          }
        }
        provider "volterra" {
          api_cert = var.api_cert
          api_key = var.api_key
          url = var.api_url
        }

```

In the directory where your terraform files are, run:

```ql-syntax
terraform init

```

Then:

```ql-syntax
terraform apply

```

**Code :**

```auto
resource "volterra_origin_pool" "origin-ip" {
  name = "origin-ip"
  namespace = "mynamespace"
 
   origin_servers {

     public_ip {
      ip = "1.1.1.1"
     }

    labels = {
    }
  }

  use_tls {
    use_host_header_as_sni = true
  tls_config {
    default_security = true
  }
  skip_server_verification = true
  no_mtls = true
  }

  no_tls = false
  port = "443"
  endpoint_selection = "LOCALPREFERED"
  loadbalancer_algorithm = "LB_OVERRIDE"
}

```

**Tested this on version:**

No Version Found
