Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-security-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-security-group
Commits
3ce61607
Commit
3ce61607
authored
Sep 12, 2018
by
Anton Babenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup after #74
parent
9efeb021
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
114 deletions
+18
-114
README.md
examples/complete/README.md
+1
-1
main.tf
examples/complete/main.tf
+16
-0
README.md
examples/fixed_name/README.md
+0
-31
main.tf
examples/fixed_name/main.tf
+0
-57
outputs.tf
examples/fixed_name/outputs.tf
+0
-24
variables.tf
variables.tf
+1
-1
No files found.
examples/complete/README.md
View file @
3ce61607
# Complete Security Group example
Configuration in this directory creates set of Security Group and Security Group Rules resources in various combination.
Configuration in this directory creates set of Security Group and Security Group Rules resources in various combination
s
.
Data sources are used to discover existing VPC resources (VPC and default security group).
...
...
examples/complete/main.tf
View file @
3ce61607
...
...
@@ -357,3 +357,19 @@ module "ipv4_ipv6_example" {
},
]
}
#################################
# Security group with fixed name
#################################
module
"fixed_name_sg"
{
source
=
"../../"
name
=
"fixed-name-sg"
description
=
"Security group with fixed name"
vpc_id
=
"
${data
.
aws_vpc
.
default
.
id
}
"
use_name_prefix
=
false
ingress_cidr_blocks
=
[
"10.10.0.0/16"
]
ingress_rules
=
[
"https-443-tcp"
]
}
examples/fixed_name/README.md
deleted
100644 → 0
View file @
9efeb021
# Complete Security Group example
Configuration in this directory creates set of Security Group and Security Group Rules resources in various combination.
Data sources are used to discover existing VPC resources (VPC and default security group).
## Usage
To run this example you need to execute:
```
bash
$
terraform init
$
terraform plan
$
terraform apply
```
Note that this example may create resources which cost money. Run
`terraform destroy`
when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Outputs
| Name | Description |
|------|-------------|
| this_security_group_description | The description of the security group |
| this_security_group_id | The ID of the security group |
| this_security_group_name | The name of the security group |
| this_security_group_owner_id | The owner ID |
| this_security_group_vpc_id | The VPC ID |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
examples/fixed_name/main.tf
deleted
100644 → 0
View file @
9efeb021
provider
"aws"
{
region
=
"eu-west-1"
}
#############################################################
# Data sources to get VPC and default security group details
#############################################################
data
"aws_vpc"
"default"
{
default
=
true
}
data
"aws_security_group"
"default"
{
name
=
"default"
vpc_id
=
"
${data
.
aws_vpc
.
default
.
id
}
"
}
##################################
# Security group with a fixed name
##################################
module
"fixed_name_sg"
{
source
=
"../../"
name
=
"fixed-name-sg"
description
=
"Security group with a fixed name and minimal rules"
use_name_prefix
=
"false"
vpc_id
=
"
${data
.
aws_vpc
.
default
.
id
}
"
tags
=
{
Cash
=
"king"
Department
=
"kingdom"
}
# Default CIDR blocks, which will be used for all ingress rules in this module. Typically these are CIDR blocks of the VPC.
# If this is not specified then no CIDR blocks will be used.
ingress_cidr_blocks
=
[
"10.10.0.0/16"
]
# Open for all CIDRs defined in ingress_cidr_blocks
ingress_rules
=
[
"https-443-tcp"
]
# Open for self (rule or from_port+to_port+protocol+description)
ingress_with_self
=
[
{
rule
=
"all-all"
},
]
# Default CIDR blocks, which will be used for all egress rules in this module. Typically these are CIDR blocks of the VPC.
# If this is not specified then no CIDR blocks will be used.
egress_cidr_blocks
=
[
"10.10.0.0/16"
]
# Open for self (rule or from_port+to_port+protocol+description)
egress_with_self
=
[
{
rule
=
"all-all"
},
]
}
examples/fixed_name/outputs.tf
deleted
100644 → 0
View file @
9efeb021
output
"this_security_group_id"
{
description
=
"The ID of the security group"
value
=
"
${module
.
fixed_name_sg
.
this_security_group_id
}
"
}
output
"this_security_group_vpc_id"
{
description
=
"The VPC ID"
value
=
"
${module
.
fixed_name_sg
.
this_security_group_vpc_id
}
"
}
output
"this_security_group_owner_id"
{
description
=
"The owner ID"
value
=
"
${module
.
fixed_name_sg
.
this_security_group_owner_id
}
"
}
output
"this_security_group_name"
{
description
=
"The name of the security group"
value
=
"
${module
.
fixed_name_sg
.
this_security_group_name
}
"
}
output
"this_security_group_description"
{
description
=
"The description of the security group"
value
=
"
${module
.
fixed_name_sg
.
this_security_group_description
}
"
}
variables.tf
View file @
3ce61607
...
...
@@ -15,8 +15,8 @@ variable "name" {
}
variable
"use_name_prefix"
{
default
=
"true"
description
=
"Whether to use name_prefix or fixed name. Should be true to able to update security group name after initial creation"
default
=
true
}
variable
"description"
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment