/f5-terraform

Primary LanguageShellMIT LicenseMIT

NOTICE:

Please note, the official terraform BIG-IP provider is located here:

Please direct all official terraform inquiries to above.

The official BIG-IP provider above contains native resources to help facilitate provisioning services on BIG-IPs themselves.

On the other hand, this unofficial project contains templates/modules that demonstrate deploying the actual BIG-IP Virtual Edition instances themselves. This project contains has not been updated in a very long time but still serves as an additional reference and placeholder for similar deployment examples. Stay tuned

TERRAFORM

This project contains examples of how to deploy F5 services with terraform.

This project attempts to achieve some of the best practices described in links below as well as heavily borrows from their examples.

ex. creating reusable modules / seperate repos

  • one for infrastructure (blue prints) -> ex. "modules" directory
  • one for live deployments (houses) -> ex. "reference" directory

REQUIREMENTS

The following are general prerequisites for these templates:

USAGE

The most challenging part will be obtaining the necessary credentials for each provider. The templates rely on environmental variables for the provider credentials. See the individual provider for each environment for more details.

https://www.terraform.io/docs/providers/openstack/index.html https://www.terraform.io/docs/providers/aws/index.html https://www.terraform.io/docs/providers/azurerm/index.html https://www.terraform.io/docs/providers/google/index.html

For example, if manually setting environment variables, the file can look like:

> cat my-terraform-provider-creds 
#!/bin/bash

# OPENSTACK CREDENTIALS
export OS_AUTH_URL=http://openstack-controller.example.com:5000/v3
export OS_PROJECT_ID=d30gdec30a319d422097e5adasdfsdfsdf
export OS_PROJECT_NAME="my-project"
export OS_USER_DOMAIN_NAME="default"
export OS_USERNAME="user"
export OS_PASSWORD=XXXXXXXXXXXXX
export OS_REGION_NAME="SEA01"

# AWS CREDENTIALS
export AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXX"
export AWS_SECRET_ACCESS_KEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export AWS_DEFAULT_REGION="us-west-2"

# AZURE CREDENTIALS
export ARM_SUBSCRIPTION_ID="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export ARM_TENANT_ID="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export ARM_CLIENT_ID="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export ARM_CLIENT_SECRET="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"


# GCE CREDENTIALS
export GOOGLE_CREDENTIALS='{
  "type": "service_account",
  "project_id": "my-project",
  "private_key_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "private_key": "-----BEGIN PRIVATE KEY-----XXXXXXXXXXXXXXXXXXXXXXXXX-----END PRIVATE KEY-----\n",
  "client_email": "user@my-project.iam.gserviceaccount.com",
  "client_id": "XXXXXXXXXXXXXXXXXXX",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/my-project.iam.gserviceaccount.com"
}'

export GOOGLE_PROJECT="my-project"
export GOOGLE_REGION="us-west1"

then before you start, simply run:

> source my-terraform-provider-creds

Next, as most of the examples leverage modules ( reusable templates ), you must first import or "get" them.

  • terraform get

    • In many cases, the modules reference a remote link as the source so internet connectivity will be required.
    • hint: use "terraform get -update=true" to make sure your modules are up-to-date
  • terraform plan

  • terraform apply

  • terraform destroy

For more information using terraform, please see:

Terraform

Getting Started

QUICK START

source my-terraform-creds # see above
cd reference/[dir]
cp terraform.tfvars.example terraform.tfvars
vim terraform.tfvars      # configure any variables required
terraform get
terraform apply

REFERENCE LINKS

Please note, the official terraform BIG-IP provider is located here:

Please direct all official inquries to above.

TESTING NOTES

Tested with Terraform v0.9.8

ISSUES/WORKAROUNDS:

A list of known issues encountered / workarounds incorporated into the templates. They can generally be categorized into following: