Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
terraform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
702
HADOOP
terraform
Commits
05821fa7
"src/git@gitlab.cesnet.cz:713/warden/warden-archive.git" did not exist on "e37ecc64c320cad1c264c28127bdc07d2858fac1"
Commit
05821fa7
authored
4 years ago
by
František Dvořák
Browse files
Options
Downloads
Patches
Plain Diff
Add firewall rules for ssh admin access + refactoring
parent
d7510249
No related branches found
No related tags found
No related merge requests found
Pipeline
#569
passed
4 years ago
Stage: build
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+1
-3
1 addition, 3 deletions
README.md
deploy.tf
+4
-1
4 additions, 1 deletion
deploy.tf
firewall.tf
+28
-35
28 additions, 35 deletions
firewall.tf
variables.tf
+8
-9
8 additions, 9 deletions
variables.tf
with
41 additions
and
48 deletions
README.md
+
1
−
3
View file @
05821fa7
...
...
@@ -51,10 +51,8 @@ For example (check also the other values used in *variables.tf*):
cat <<EOF > mycluster.auto.tfvars
domain = 'mydomain'
n = 3
security_trusted_cidr
4
= [
security_trusted_cidr = [
"0.0.0.0/0",
]
security_trusted_cidr6 = [
"::/0",
]
ssh = 'mykey'
...
...
This diff is collapsed.
Click to expand it.
deploy.tf
+
4
−
1
View file @
05821fa7
...
...
@@ -101,7 +101,10 @@ resource "openstack_compute_instance_v2" "server" {
flavor_name
=
var
.
flavor
image_name
=
var
.
image
key_pair
=
var
.
ssh
security_groups
=
[
openstack_networking_secgroup_v2
.
secgroup
.
name
]
security_groups
=
[
openstack_networking_secgroup_v2
.
all
.
name
,
openstack_networking_secgroup_v2
.
ssh
.
name
,
]
user_data
=
data
.
template_cloudinit_config
.
ctx
[
count
.
index
].
rendered
network
{
name
=
var
.
local_network
...
...
This diff is collapsed.
Click to expand it.
firewall.tf
+
28
−
35
View file @
05821fa7
resource
"openstack_networking_secgroup_v2"
"
secgroup
"
{
name
=
var
.
domain
description
=
"
${
title
(
var
.
domain
)}
security group"
resource
"openstack_networking_secgroup_v2"
"
all
"
{
name
=
format
(
"%s.all"
,
var
.
domain
)
description
=
"
${
title
(
var
.
domain
)}
all
security group"
}
resource
"openstack_networking_secgroup_rule_v2"
"secgroup_rule_self4"
{
direction
=
"ingress"
ethertype
=
"IPv4"
remote_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
security_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
resource
"openstack_networking_secgroup_v2"
"ssh"
{
name
=
format
(
"%s.ssh"
,
var
.
domain
)
description
=
"
${
title
(
var
.
domain
)}
ssh security group"
}
resource
"openstack_networking_secgroup_rule_v2"
"secgroup_rule_self6"
{
resource
"openstack_networking_secgroup_rule_v2"
"all_self"
{
for_each
=
toset
([
"0.0.0.0/0"
,
"::/0"
])
direction
=
"ingress"
ethertype
=
"IPv6"
remote_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
security_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
ethertype
=
length
(
regexall
(
":"
,
each
.
value
))
==
0
?
"IPv4"
:
"IPv6"
remote_group_id
=
openstack_networking_secgroup_v2
.
all
.
id
security_group_id
=
openstack_networking_secgroup_v2
.
all
.
id
}
resource
"openstack_networking_secgroup_rule_v2"
"secgroup_rule_icmp4"
{
resource
"openstack_networking_secgroup_rule_v2"
"all_icmp"
{
for_each
=
toset
([
"0.0.0.0/0"
,
"::/0"
])
direction
=
"ingress"
ethertype
=
"IPv4
"
protocol
=
"
icmp"
security_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
ethertype
=
length
(
regexall
(
":"
,
each
.
value
))
==
0
?
"IPv4"
:
"IPv6
"
protocol
=
each
.
value
==
"0.0.0.0/0"
?
"icmp"
:
"ipv6-
icmp"
security_group_id
=
openstack_networking_secgroup_v2
.
all
.
id
}
resource
"openstack_networking_secgroup_rule_v2"
"secgroup_rule_icmp6"
{
resource
"openstack_networking_secgroup_rule_v2"
"all_other"
{
for_each
=
var
.
security_trusted_cidr
direction
=
"ingress"
ethertype
=
"IPv6"
protocol
=
"ipv6-icmp"
security_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
ethertype
=
length
(
regexall
(
":"
,
each
.
value
))
==
0
?
"IPv4"
:
"IPv6"
remote_ip_prefix
=
each
.
key
security_group_id
=
openstack_networking_secgroup_v2
.
all
.
id
}
resource
"openstack_networking_secgroup_rule_v2"
"secgroup_rule_other4"
{
for_each
=
var
.
security_trusted_cidr4
resource
"openstack_networking_secgroup_rule_v2"
"all_floatip"
{
direction
=
"ingress"
ethertype
=
"IPv4"
remote_ip_prefix
=
each
.
key
security_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
remote_ip_prefix
=
"
${
openstack_networking_floatingip_v2
.
floatip_1
.
address
}
/32"
security_group_id
=
openstack_networking_secgroup_v2
.
all
.
id
}
resource
"openstack_networking_secgroup_rule_v2"
"s
ecgroup_rule_other6
"
{
for_each
=
var
.
security_
trusted
_cidr
6
resource
"openstack_networking_secgroup_rule_v2"
"s
sh
"
{
for_each
=
var
.
security_
admin
_cidr
direction
=
"ingress"
ethertype
=
"IPv6"
ethertype
=
length
(
regexall
(
":"
,
each
.
value
))
==
0
?
"IPv4"
:
"IPv6"
remote_ip_prefix
=
each
.
key
security_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
}
resource
"openstack_networking_secgroup_rule_v2"
"secgroup_rule_floatip"
{
direction
=
"ingress"
ethertype
=
"IPv4"
remote_ip_prefix
=
"
${
openstack_networking_floatingip_v2
.
floatip_1
.
address
}
/32"
security_group_id
=
openstack_networking_secgroup_v2
.
secgroup
.
id
security_group_id
=
openstack_networking_secgroup_v2
.
ssh
.
id
}
This diff is collapsed.
Click to expand it.
variables.tf
+
8
−
9
View file @
05821fa7
...
...
@@ -49,8 +49,14 @@ variable "public_network" {
# default = "public-cesnet-78-128-250-PERSONAL"
}
variable
"security_trusted_cidr4"
{
description
=
"Trusted networks"
variable
"security_admin_cidr"
{
description
=
"Admin networks (ssh only)"
type
=
set
(
string
)
default
=
[]
}
variable
"security_trusted_cidr"
{
description
=
"Trusted networks (all, ssh included)"
type
=
set
(
string
)
default
=
[
"78.128.128.0/17"
,
# CESNET
...
...
@@ -65,13 +71,6 @@ variable "security_trusted_cidr4" {
"193.84.192.0/19"
,
# SLU
"195.113.0.0/16"
,
# CESNET
"195.178.64.0/19"
,
# CESNET
]
}
variable
"security_trusted_cidr6"
{
description
=
"Trusted networks"
type
=
set
(
string
)
default
=
[
"2001:718::/32"
,
# CESNET
]
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment