This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HCF-451 Fix deployment hooks for proxy configuration
Also set up a AWS terraform configuration to use proxies.
- Loading branch information
Showing
15 changed files
with
829 additions
and
70 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -13,7 +13,8 @@ password | |
.vagrant | ||
*.box | ||
*.vmdk | ||
hcf-ucp.json | ||
/hcf-ucp.json | ||
.demos | ||
hcf.tf | ||
src/*-clone | ||
/*.tf | ||
/*.tf.json |
This file contains 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 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 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 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,89 @@ | ||
# -*- coding: utf-8 -*- | ||
## Terraform/AWS with proxy output provider | ||
## Specialization of generic TF to test a proxied configuration | ||
# # ## ### ##### ######## | ||
|
||
require_relative 'tf-aws' | ||
|
||
class ToTerraformAWSWithProxy < ToTerraformAWS | ||
|
||
def special_variables | ||
super + %w(HTTP_PROXY http_proxy HTTPS_PROXY https_proxy) | ||
end | ||
|
||
def security_groups | ||
super.merge( | ||
'backend' => { | ||
'tags' => { | ||
'Name' => '${var.cluster-prefix}-backend' | ||
}, | ||
'name' => '${var.cluster-prefix}-backend', | ||
'description' => 'Backend', | ||
'vpc_id' => '${aws_vpc.cluster.id}' | ||
} | ||
) | ||
end | ||
|
||
def security_group_rules(roles) | ||
rules = {} | ||
rules.merge! frontend_security_group_rules | ||
rules.merge! exposed_ports_security_group_rules('backend', roles) | ||
rules.merge! backend_security_group_rules | ||
rules | ||
end | ||
|
||
def frontend_security_group_rules | ||
super.merge( | ||
'frontend_ingress_ssh' => { | ||
# Allow proxy inbound traffic to sshd | ||
'security_group_id' => '${aws_security_group.frontend.id}', | ||
'type' => 'ingress', | ||
'from_port' => 22, | ||
'to_port' => 22, | ||
'protocol' => 'tcp', | ||
'cidr_blocks' => ['0.0.0.0/0'] | ||
}, | ||
'frontend_ingress_http_proxy' => { | ||
# Allow proxy inbound traffic to sshd | ||
'security_group_id' => '${aws_security_group.frontend.id}', | ||
'type' => 'ingress', | ||
'from_port' => 3128, | ||
'to_port' => 3128, | ||
'protocol' => 'tcp', | ||
'source_security_group_id' => '${aws_security_group.backend.id}' | ||
} | ||
) | ||
end | ||
|
||
def backend_security_group_rules | ||
{ | ||
'backend_egress_self' => { | ||
# Allow core outbound traffic to itself | ||
'security_group_id' => '${aws_security_group.backend.id}', | ||
'type' => 'egress', | ||
'from_port' => 0, | ||
'to_port' => 0, | ||
'protocol' => '-1', | ||
'self' => true | ||
}, | ||
'backend_egress_frontend' => { | ||
# Allow core outbound traffic to the proxy | ||
'security_group_id' => '${aws_security_group.backend.id}', | ||
'type' => 'egress', | ||
'from_port' => 3128, | ||
'to_port' => 3128, | ||
'protocol' => 'tcp', | ||
'source_security_group_id' => '${aws_security_group.frontend.id}' | ||
}, | ||
'backend_egress_hairpin' => { | ||
# Allow core outbound traffic to itself via the public IP | ||
'security_group_id' => '${aws_security_group.backend.id}', | ||
'type' => 'egress', | ||
'from_port' => 0, | ||
'to_port' => 0, | ||
'protocol' => '-1', | ||
'cidr_blocks' => ['${null_resource.PUBLIC_IP.triggers.PUBLIC_IP}/32'] | ||
} | ||
} | ||
end | ||
end |
This file contains 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 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 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 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.