Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

Commit 0cfd601

Browse files
authored
Merge pull request #31 from codygreen/master
Milestone 0.1.2
2 parents b1d68cc + 4470e57 commit 0cfd601

File tree

19 files changed

+819
-89
lines changed

19 files changed

+819
-89
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@
99
*.tfvars
1010

1111
# Terraform crash log
12-
**/crash.log
12+
**/crash.log
13+
14+
# Go Tests
15+
**/vendor
16+
**/Gopkg.toml
17+
**/Gopkg.lock

.travis.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
language: go
2+
sudo: false
3+
4+
go:
5+
- master
6+
7+
branches:
8+
only:
9+
- master
10+
11+
env:
12+
- TF_INPUT=false TF_IN_AUTOMATION=true
13+
14+
# Install terraform
15+
before_install:
16+
- curl -sLo /tmp/terraform.zip https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip
17+
- unzip /tmp/terraform.zip -d /tmp
18+
- mkdir -p ~/bin
19+
- mv /tmp/terraform ~/bin
20+
- export PATH="~/bin:$PATH"
21+
22+
script:
23+
- go test -v -count=1 -timeout 30m ./...

README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,79 @@
11
# AWS BIG-IP Terraform Module
2-
Terraform module to deploy an F5 BIG-IP in AWS. This module currently supports 1 and 3 nic deployments using the AWS Marketplace PAYG (pay-as-you-go) license.
2+
Terraform module to deploy an F5 BIG-IP in AWS. This module currently supports 1 and 3 nic deployments and defaults to using the AWS Marketplace PAYG (pay-as-you-go) 200Mbps BEST license. If you would like to use a bring your own license (BYOL) AMI the set the *f5_ami_search_name* variable accordingly.
33

44
**NOTE:** You will need to accept the AWS Marketplace offer for your selected BIG-IP AMI.
55
**NOTE:** This code is provided for demonstration purposes and is not intended to be used for production deployments.
66

7+
## Password Policy (New in 0.1.2)
8+
For security reasons the module no longer generates a random password that is stored in the Terraform state file. Instead, a password must be created in the AWS Secrets Manager and the Secret name must be supplied to the module. For demonstration purposes, the examples show how to do this using an randomly generated password.
9+
10+
## Dependencies
11+
This module requires that the user has created a password and stored it in the AWS Secret Manager before calling the module. For information on how to do this please refer to the [AWS Secret Manager docs](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html).
12+
713
## Terraform Version
814
This modules supports Terraform 0.12 and higher
915

10-
## Example 1-NIC Deployment
16+
## Examples
17+
We have provided some common deployment examples below. However, if you would like to see full end-to-end examples with the creation of all required objects check out the [examples](https://github.com/f5devcentral/terraform-aws-bigip/tree/master/examples) folder in the [GitHub repository](https://github.com/f5devcentral/terraform-aws-bigip/).
18+
19+
### Example 1-NIC Deployment PAYG
20+
```hcl
21+
module bigip {
22+
source = "f5devcentral/bigip/aws"
23+
version = "0.1.2"
24+
25+
prefix = "bigip"
26+
f5_instance_count = 1
27+
ec2_key_name = "my-key"
28+
aws_secretmanager_secret_id = "my_bigip_password"
29+
mgmt_subnet_security_group_ids = [sg-01234567890abcdef]
30+
vpc_mgmt_subnet_ids = [subnet-01234567890abcdef]
31+
}
32+
```
33+
### Example 1-NIC Deployment BYOL
1134
```hcl
1235
module bigip {
1336
source = "f5devcentral/bigip/aws"
37+
version = "0.1.2"
1438
1539
prefix = "bigip"
1640
f5_instance_count = 1
1741
ec2_key_name = "my-key"
42+
aws_secretmanager_secret_id = "my_bigip_password"
1843
mgmt_subnet_security_group_ids = [sg-01234567890abcdef]
1944
vpc_mgmt_subnet_ids = [subnet-01234567890abcdef]
45+
f5_ami_search_name = "F5 Networks BIGIP-14.0.1*BYOL*All Modules 1 Boot*"
2046
}
2147
```
22-
## Example 3-NIC Deployment
48+
49+
### Example 3-NIC Deployment PAYG
2350
```hcl
2451
module bigip {
2552
source = "f5devcentral/bigip/aws"
53+
version = "0.1.2"
2654
2755
prefix = "bigip"
2856
f5_instance_count = 1
2957
ec2_key_name = "my-key"
58+
aws_secretmanager_secret_id = "my_bigip_password"
3059
mgmt_subnet_security_group_ids = [sg-01234567890abcdef]
3160
public_subnet_security_group_ids = [sg-01234567890ghijkl]
3261
private_subnet_security_group_ids = [sg-01234567890mnopqr]
3362
vpc_mgmt_subnet_ids = [subnet-01234567890abcdef]
34-
vpc_private_subnet_ids = [subnet-01234567890ghijkl]
35-
vpc_mgmt_subnet_ids = [subnet-01234567890mnopqr]
63+
vpc_public_subnet_ids = [subnet-01234567890ghijkl]
64+
vpc_private_subnet_ids = [subnet-01234567890mnopqr]
3665
}
66+
```
67+
68+
## Finding AWS Machine Images (AMI)
69+
If there is a specific F5 BIG-IP AMI you would like to use you can update the f5_ami_search_name variable to reflect the AMI name or name pattern you are looking for.
70+
71+
Example to find F5 AMIs for PAYG 200Mbps BEST licensing:
72+
```bash
73+
aws ec2 describe-images --owners 679593333241 --filters "Name=name, Values=F5 Networks BIGIP-14.0.1-0.0.14* PAYG - Best 200Mbps*"
74+
```
75+
76+
Example to find F5 AMIs for BYOL 200Mbps BEST licensing:
77+
```bash
78+
aws ec2 describe-images --owners 679593333241 --filters "Name=name, Values=F5 Networks BIGIP-14.0.1*BYOL*All Modules 1 Boot*"
3779
```

examples/1_nic_with_new_vpc/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# New VPC with a 1-nic BIG-IP in each AZ
2-
This examples deploys a new VPC and builds a 1-nic BIG-IP in each availability zones
2+
This examples deploys a new VPC with subnets across 2 availability zones. It also builds a 1-nic BIG-IP in each availability zone.
3+
4+
**Note:** This example creates a random, temporary password for the BIG-IP which is stored in the Terraform state file. This is not a good practice for production environments. Ideally, you would use a random password generated by the AWS Secrets Manager.
35

46
## Usage
57
To run this example run the following commands:

examples/1_nic_with_new_vpc/main.tf

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
provider "aws" {
22
region = local.region
3+
# access_key = var.AccessKeyID
4+
# secret_key = var.SecretAccessKey
35
}
46

57
#
@@ -9,6 +11,26 @@ resource "random_id" "id" {
911
byte_length = 2
1012
}
1113

14+
#
15+
# Create random password for BIG-IP
16+
#
17+
resource "random_password" "password" {
18+
length = 16
19+
special = true
20+
override_special = "_%@"
21+
}
22+
23+
#
24+
# Create Secret Store and Store BIG-IP Password
25+
#
26+
resource "aws_secretsmanager_secret" "bigip" {
27+
name = format("%s-bigip-secret-%s", var.prefix, random_id.id.hex)
28+
}
29+
resource "aws_secretsmanager_secret_version" "bigip-pwd" {
30+
secret_id = aws_secretsmanager_secret.bigip.id
31+
secret_string = random_password.password.result
32+
}
33+
1234
#
1335
# Create the VPC
1436
#
@@ -97,8 +119,9 @@ module bigip {
97119
local.prefix,
98120
random_id.id.hex
99121
)
100-
f5_instance_count = length(local.azs)
101-
ec2_key_name = var.ec2_key_name
122+
f5_instance_count = length(local.azs)
123+
ec2_key_name = var.ec2_key_name
124+
aws_secretmanager_secret_id = aws_secretsmanager_secret.bigip.id
102125
mgmt_subnet_security_group_ids = [
103126
module.web_server_sg.this_security_group_id,
104127
module.web_server_secure_sg.this_security_group_id,

examples/1_nic_with_new_vpc/outputs.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,11 @@ output "bigip_mgmt_port" {
1919
}
2020
# BIG-IP Password
2121
output "password" {
22-
value = module.bigip.password
22+
value = random_password.password
23+
sensitive = true
24+
}
25+
26+
# BIG-IP Password Secret name
27+
output "aws_secretmanager_secret_name" {
28+
value = aws_secretsmanager_secret.bigip.name
2329
}

examples/1_nic_with_new_vpc/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@ variable "ec2_key_name" {
66
description = "AWS EC2 Key name for SSH access"
77
type = string
88
}
9+
10+
# variable "AccessKeyID" {}
11+
12+
# variable "SecretAccessKey" {}
13+
14+
variable "prefix" {
15+
description = "Prefix for resources created by this module"
16+
type = string
17+
default = "terraform-aws-bigip-1nic"
18+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# New VPC with a 3-nic BIG-IP in each AZ
2+
This examples deploys a new VPC with subnets across 2 availability zones. It also builds a 3-nic BIG-IP in each availability zone.
3+
4+
**Note:** This example creates a random, temporary password for the BIG-IP which is stored in the Terraform state file. This is not a good practice for production environments. Ideally, you would use a random password generated by the AWS Secrets Manager.
5+
6+
## Usage
7+
To run this example run the following commands:
8+
```bash
9+
terraform init
10+
terraform plan
11+
terraform apply --auto-approve
12+
```
13+
14+
**Note:** this examples deploys resources that will cost money. Please run the following command to destroy your environment when finished:
15+
```bash
16+
terraform destroy --auto-approve
17+
```

examples/3_nic_with_new_vpc/main.tf

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,26 @@ resource "random_id" "id" {
99
byte_length = 2
1010
}
1111

12+
#
13+
# Create random password for BIG-IP
14+
#
15+
resource "random_password" "password" {
16+
length = 16
17+
special = true
18+
override_special = "_%@"
19+
}
20+
21+
#
22+
# Create Secret Store and Store BIG-IP Password
23+
#
24+
resource "aws_secretsmanager_secret" "bigip" {
25+
name = format("%s-bigip-secret-%s", var.prefix, random_id.id.hex)
26+
}
27+
resource "aws_secretsmanager_secret_version" "bigip-pwd" {
28+
secret_id = aws_secretsmanager_secret.bigip.id
29+
secret_string = random_password.password.result
30+
}
31+
1232
#
1333
# Create the VPC
1434
#
@@ -98,8 +118,10 @@ module bigip {
98118
local.prefix,
99119
random_id.id.hex
100120
)
101-
f5_instance_count = length(local.azs)
102-
ec2_key_name = var.ec2_key_name
121+
f5_instance_count = length(local.azs)
122+
ec2_instance_type = "m5.large"
123+
ec2_key_name = var.ec2_key_name
124+
aws_secretmanager_secret_id = aws_secretsmanager_secret.bigip.id
103125
mgmt_subnet_security_group_ids = [
104126
module.web_server_secure_sg.this_security_group_id,
105127
module.ssh_secure_sg.this_security_group_id

examples/3_nic_with_new_vpc/outputs.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,11 @@ output "bigip_mgmt_port" {
1919
}
2020
# BIG-IP Password
2121
output "password" {
22-
value = module.bigip.password
22+
value = random_password.password
23+
sensitive = true
24+
}
25+
26+
# BIG-IP Password Secret name
27+
output "aws_secretmanager_secret_name" {
28+
value = aws_secretsmanager_secret.bigip.name
2329
}

0 commit comments

Comments
 (0)