-
Notifications
You must be signed in to change notification settings - Fork 171
Add docs for managing Google deployments via F5 ADS TF provider #2270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
puneetsarna
wants to merge
1
commit into
main
Choose a base branch
from
ps-dev-tf-naas
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
content/nginxaas/google/deploy/create-deployment/deploy-terraform.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| --- | ||
| title: Deploy using the Terraform provider | ||
| weight: 100 | ||
| toc: true | ||
| f5-docs: DOCS-000 | ||
| url: /nginxaas/google/deploy/create-deployment/deploy-terraform/ | ||
| f5-content-type: how-to | ||
| f5-product: NGINXaaS for Google Cloud | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| This guide explains how to create an F5 NGINXaaS for Google Cloud (NGINXaaS) deployment using the [`F5Networks/f5ads` Terraform provider](https://registry.terraform.io/providers/F5Networks/f5ads/latest/docs). This guide only covers creating a deployment. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| {{< include "/nginxaas/google/terraform-prerequisites.md" >}} | ||
|
|
||
| ## Configure the provider | ||
|
|
||
| Add the `f5ads` provider to your Terraform configuration and pin it to the exact alpha version: | ||
|
|
||
| ```hcl | ||
| terraform { | ||
| required_providers { | ||
| f5ads = { | ||
| source = "F5Networks/f5ads" | ||
| version = "0.1.0-alpha.1" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "f5ads" { | ||
| geo = "us" | ||
| } | ||
| ``` | ||
|
|
||
| The provider needs your F5 ADS client credentials to authenticate. You can supply them in the provider block, or with environment variables: | ||
|
|
||
| ```hcl | ||
| provider "f5ads" { | ||
| geo = "us" | ||
| client_id = "your-client-id" | ||
| client_secret = "your-client-secret" | ||
| } | ||
| ``` | ||
|
|
||
| ```shell | ||
| export F5ADS_GEO="us" | ||
| export F5ADS_CLIENT_ID="your-client-id" | ||
| export F5ADS_CLIENT_SECRET="your-client-secret" | ||
| ``` | ||
|
|
||
| ## Create GCP network resources | ||
|
|
||
| Include the following snippet if you need to create a VPC, subnet, and [network attachment](https://cloud.google.com/vpc/docs/about-network-attachments) for your deployment. Add the [`hashicorp/google` provider](https://registry.terraform.io/providers/hashicorp/google/latest/docs) to authenticate to your GCP project. | ||
|
|
||
| ```hcl | ||
| provider "google" { | ||
| region = "us-east1" | ||
| } | ||
|
|
||
| resource "google_compute_network" "vpc" { | ||
| name = "my-vpc" | ||
| auto_create_subnetworks = false | ||
| } | ||
|
|
||
| resource "google_compute_subnetwork" "subnet" { | ||
| name = "my-subnet" | ||
| ip_cidr_range = "10.0.0.0/24" | ||
| region = "us-east1" | ||
| network = google_compute_network.vpc.id | ||
| } | ||
|
|
||
| resource "google_compute_network_attachment" "attachment" { | ||
| name = "my-network-attachment" | ||
| region = "us-east1" | ||
| connection_preference = "ACCEPT_AUTOMATIC" | ||
| subnetworks = [google_compute_subnetwork.subnet.id] | ||
| } | ||
| ``` | ||
|
|
||
| {{< call-out class="caution" >}} | ||
| The `f5ads` provider currently only supports network attachments with `connection_preference` set to `ACCEPT_AUTOMATIC`, which accepts connections from all projects. Support for `ACCEPT_MANUAL` is planned for an upcoming release. See [Google's documentation on creating a network attachment](https://cloud.google.com/vpc/docs/create-manage-network-attachments#create-network-attachments) for details. | ||
| {{< /call-out >}} | ||
|
|
||
| ## Create a deployment | ||
|
|
||
| {{< call-out class="important" >}} | ||
| Create or reuse an existing configuration in the [F5 ADS Console]({{< ref "/nginxaas/google/deploy/nginx-configuration/nginx-configuration-console.md" >}}) first, then supply its [Configuration ID and Configuration Version ID]({{< ref "/nginxaas/google/deploy/nginx-configuration/nginx-configuration-console.md#get-nginx-configuration-version-information" >}}) below. | ||
| {{< /call-out >}} | ||
|
|
||
| Choose a frontend type for your deployment. Refer to [Service frontend]({{< ref "/nginxaas/google/overview.md#service-frontend" >}}) for more information on these two frontend types. | ||
|
|
||
| To use a managed public endpoint: | ||
|
|
||
| ```hcl | ||
| resource "f5ads_deployment" "example" { | ||
| name = "my-deployment" | ||
| capacity = 20 | ||
| waf_enabled = true | ||
| nginx_config_id = "cfg_example123" | ||
| nginx_config_version_id = "cv_example456" | ||
|
|
||
| google_cloud_properties = { | ||
| region = "us-east1" | ||
| network_attachment = google_compute_network_attachment.attachment.id | ||
|
|
||
| frontend = { | ||
| managed_public_endpoint = { | ||
| acl = [ | ||
| { | ||
| source_prefixes = ["0.0.0.0/0"] | ||
| port_range = "80" | ||
| protocol = "tcp" | ||
| }, | ||
| { | ||
| source_prefixes = ["0.0.0.0/0"] | ||
| port_range = "443" | ||
| protocol = "tcp" | ||
| }, | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| To use a private endpoint instead, replace the `managed_public_endpoint` block with a `private_endpoint` block: | ||
|
|
||
| ```hcl | ||
| frontend = { | ||
| private_endpoint = { | ||
| service_attachment_accept_list = [ | ||
| "my-gcp-project", | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Create the deployment: | ||
|
|
||
| ```shell | ||
| terraform init | ||
| terraform plan | ||
| terraform apply | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the frontmatter is incomplete, missing:
description
f5-summary
f5-keywords
f5-audience
https://github.com/nginx/documentation/blob/main/templates/how-to/guide-how-to.md#frontmatter-fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JTorreG Do you have examples of what these values might be? P.S I am looking the deploy-console.md page at the same level which has what I have on the Terraform page.