Examples of F5 Distributed Cloud (XC) deployments utilizing Terraform. For more information on the use cases covered by this project, please see the following articles and workflow guides:
DevCentral Overview Articles | Use Case / Workflow Guides (SaaS Console, Automation) |
---|---|
Deploy API Security on Regional Edges with F5 Distributed Cloud | Deploy F5 XC API Security on XC Regional Edges |
Deploy API Security Anywhere with F5 Distributed Cloud | Deploy F5 XC API Security on XC Regional Edges + AppConnect |
Deploy API Security Anywhere with F5 Distributed Cloud | Deploy F5 XC API Security on XC Customer Edges |
- F5 Distributed Cloud Account (F5XC)
- AWS Account - Due to the assets being created, free tier will not work.
- The F5 BIG-IP AMI being used from the AWS Marketplace must be subscribed to your account
- Please make sure resources like VPC and Elastic IP's are below the threshold limit in that aws region
- Terraform Cloud Account
- GitHub Account
Example: f5-xc-waf-on-re
Check the Automation section in your workflow guide for more details.
- xc: F5 Distributed Cloud WAAP
- infra: AWS Infrastructure (VPC, IGW, etc.)
- eks: AWS Elastic Kubernetes Service
- arcadia: Arcadia Finance test web application and API
- juiceshop: OWASP Juice Shop test web application
- Cloud Provider: AWS
- IAC: Terraform
- IAC State: Terraform Cloud
- CI/CD: GitHub Actions
- Workspaces: Create a CLI or API workspace for each asset in the workflow chosen. Check the Automation section in your workflow guide for more details
Example:
Workflow | Assets/Workspaces |
---|---|
f5-xc-waf-on-re | infra, xc |
-
Workspace Sharing: Under the settings for each Workspace, set the Remote state sharing to share with each Workspace created.
-
Variable Set: Create a Variable Set with the following values:
Name Type Description AWS_ACCESS_KEY_ID Environment Your AWS Access Key ID AWS_SECRET_ACCESS_KEY Environment Your AWS Secret Access Key AWS_SESSION_TOKEN Environment Your AWS Session Token VOLT_API_P12_FILE Environment Your F5XC API certificate file name. Set this to api.p12 VES_P12_PASSWORD Environment Set this to the password you supplied when creating your F5 XC API certificate ssh_key Terraform Your ssh key for accessing the created BIG-IP and compute assets admin_src_addr Terraform The source address and subnet in CIDR format of your administrative workstation tf_cloud_organization Terraform Your Terraform Cloud Organization name
-
Fork and Clone Repo. Navigate to
Actions
tab and enable it. -
Actions Secrets: Create the following GitHub Actions secrets in your forked repo
- P12: The linux base64 encoded F5XC API certificate
- TF_API_TOKEN: Your Terraform Cloud API token
- TF_CLOUD_ORGANIZATION: Your Terraform Cloud Organization name
- TF_CLOUD_WORKSPACE_<Workspace Name>: Create for each workspace in your workflow
- EX: TF_CLOUD_WORKSPACE_BIGIP_BASE would be created with the value
bigip-base
- EX: TF_CLOUD_WORKSPACE_BIGIP_BASE would be created with the value
STEP 1: Check out a branch for the workflow you wish to run using the following naming convention.
DEPLOY
Workflow | Branch Name |
---|---|
f5-xc-waf-on-k8s | deploy-f5-xc-waf-on-k8s |
f5-xc-waf-on-re | deploy-f5-xc-waf-on-re |
DESTROY
Workflow | Branch Name |
---|---|
f5-xc-waf-on-k8s | destroy-f5-xc-waf-on-k8s |
f5-xc-waf-on-re | destroy-f5-xc-waf-on-re |
STEP 2: Rename infra/terraform.tfvars.examples
to infra/terraform.tfvars
and add the following data:
- project_prefix = "Your project identifier name in lower case letters only - this will be applied as a prefix to all assets"
- resource_owner = "Your-name"
- aws_region = "AWS Region" ex. us-east-1
- azs = ["us-east-1a", "us-east1b"] - Change to Correct Availability Zones based on selected Region
- Also update assets boolean value as per your work-flow
Step 3: Rename xc/terraform.tfvars.examples
to xc/terraform.tfvars
and add the following data:
- api_url = "Your F5XC tenant"
- xc_tenant = "Your tenant id available in F5 XC
Administration
sectionTenant Overview
menu" - xc_namespace = "The existing XC namespace where you want to deploy resources"
- app_domain = "the FQDN of your app (cert will be autogenerated)"
- xc_waf_blocking = "Set to true to enable blocking"
STEP 4: Commit and push your build branch to your forked repo
- Build will run and can be monitored in the GitHub Actions tab and TF Cloud console
STEP 5: Once the pipeline completes, verify your assets were deployed or destroyed based on your workflow.
NOTE: The autocert process takes time. It may be 5 to 10 minutes before Let's Encrypt has provided the cert.
Outline any requirements to setup a development environment if someone would like to contribute. You may also link to another file for this information.
For support, please open a GitHub issue. Note, the code in this repository is community supported and is not supported by F5 Networks.
Please refer to the F5 DevCentral Community Code of Conduct.
Copyright 2014-2020 F5 Networks Inc.
Before you start contributing to any project sponsored by F5 Networks, Inc. (F5) on GitHub, you will need to sign a Contributor License Agreement (CLA).
If you are signing as an individual, we recommend that you talk to your employer (if applicable) before signing the CLA since some employment agreements may have restrictions on your contributions to other projects. Otherwise by submitting a CLA you represent that you are legally entitled to grant the licenses recited therein.
If your employer has rights to intellectual property that you create, such as your contributions, you represent that you have received permission to make contributions on behalf of that employer, that your employer has waived such rights for your contributions, or that your employer has executed a separate CLA with F5.
If you are signing on behalf of a company, you represent that you are legally entitled to grant the license recited therein. You represent further that each employee of the entity that submits contributions is authorized to submit such contributions on behalf of the entity pursuant to the CLA.