Skip to content
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

Feat: Use Security Group 4.x Module #94

Merged
merged 80 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
2480f55
bugfix: secondary_gids ignored in acces point creation
juan-acevedo-ntt Jul 5, 2021
463a7e6
Auto Format
cloudpossebot Jul 5, 2021
c71615e
fix format
juan-acevedo-ntt Jul 5, 2021
2adaad7
Merge branch 'master' of https://github.com/juan-acevedo-ntt/terrafor…
juan-acevedo-ntt Jul 5, 2021
68ba2cb
Add efs_backup_policy_enabled
nitrocode Jul 9, 2021
56c827b
Add aws_efs_backup_policy
nitrocode Jul 9, 2021
e6c6f8e
Auto Format
cloudpossebot Jul 9, 2021
3c1614b
Merge branch 'master' into master
juan-acevedo-ntt Aug 23, 2021
b79fa55
Make posix_user and creation_info optional in aws_efs_access_point
jgournet Sep 17, 2021
9630420
Auto Format
cloudpossebot Sep 17, 2021
cfb0ade
Add support for argument availability_zone_name
Sep 27, 2021
de26392
Skip bridgecrew check BC_AWS_GENERAL_48
Sep 27, 2021
e0ce79f
Update availability_zone_name description
Sep 27, 2021
c3fdb24
chore: readme updates
Sep 27, 2021
eae188b
Merge branch 'master' into efs_backup_policy
nitrocode Nov 5, 2021
8c8c177
Add transition_to_primary_storage_class
nitrocode Nov 5, 2021
65329f0
Add transition_to_primary_storage_class
nitrocode Nov 5, 2021
2b85ea6
Auto Format
cloudpossebot Nov 5, 2021
97771b0
Add transition_to_primary_storage_class to test
nitrocode Nov 5, 2021
39533d6
Revert "Update context.tf from origin source (#87)"
nitrocode Nov 5, 2021
4c4f1d0
Revert "feat: use security-group module instead of resource (#79)"
nitrocode Nov 5, 2021
c3fffc5
Use security group 4.0
nitrocode Nov 5, 2021
e9cbb11
Merge remote-tracking branch 'origin/efs_backup_policy' into security…
nitrocode Nov 5, 2021
df208e5
Support availability_zone_name
nitrocode Nov 5, 2021
0d6cea0
Support transition_to_primary_storage_class
nitrocode Nov 5, 2021
94b13a5
Change secondary_gids to list
nitrocode Nov 5, 2021
37fe5a3
Auto Format
cloudpossebot Nov 5, 2021
41629a6
Use a local for secondary_gids
nitrocode Nov 5, 2021
357e2ee
Update main.tf
nitrocode Nov 5, 2021
5ce0573
Correct posix users type
nitrocode Nov 5, 2021
14f8785
Change transition_* to empty strings
nitrocode Nov 5, 2021
9aa87f8
Auto Format
cloudpossebot Nov 5, 2021
73615c7
Change transition_* to default to empty string
nitrocode Nov 5, 2021
9e9acc4
Update main.tf
nitrocode Nov 5, 2021
d531e32
Split on comma
nitrocode Nov 5, 2021
da74802
Update main.tf
nitrocode Nov 5, 2021
de3c0ff
Merge remote-tracking branch 'origin/transition_to_primary_storage_cl…
nitrocode Nov 5, 2021
90edd9d
Update main.tf
nitrocode Nov 5, 2021
8b9bcc7
Update main.tf
nitrocode Nov 5, 2021
578cd2e
Merge remote-tracking branch 'juan-acevedo-ntt/master' into security-…
nitrocode Nov 5, 2021
0eb78ba
Merge remote-tracking branch 'jgournet/master' into security-group-4
nitrocode Nov 5, 2021
ac47ed7
Auto Format
cloudpossebot Nov 5, 2021
bad7a5c
Simplify true : false statement
nitrocode Nov 5, 2021
5562116
Use security_group_name instead of suffix
nitrocode Nov 8, 2021
db981a4
Convert transition vars to list(string)
nitrocode Nov 8, 2021
5624769
Set security_group_create_before_destroy to true
nitrocode Nov 8, 2021
8b2d508
Auto Format
cloudpossebot Nov 8, 2021
1482f1e
docs: Convert transition vars to list(string)
nitrocode Nov 8, 2021
afee56c
Convert zone_id to a list
nitrocode Nov 8, 2021
842dfbb
docs: Convert zone_id to a list
nitrocode Nov 8, 2021
e207eb1
Auto Format
cloudpossebot Nov 8, 2021
6d18f38
Add more to the access_points var description
nitrocode Nov 8, 2021
6b0ff18
posix_user dynamic uses correct for_each val
nitrocode Nov 8, 2021
313ce47
Auto Format
cloudpossebot Nov 8, 2021
a8f0f08
docs: make note of these changes
nitrocode Nov 8, 2021
387cd5b
Small fixes
nitrocode Nov 8, 2021
3faa67d
Auto Format
cloudpossebot Nov 8, 2021
c818884
Set kms_key_id to use list(string)
nitrocode Nov 8, 2021
4e6f5ff
Auto Format
cloudpossebot Nov 8, 2021
25f90da
Add missing type to provisioned_throughput_in_mibps
nitrocode Nov 8, 2021
2ff1c36
Fix examples/complete
nitrocode Nov 8, 2021
aa81071
zone_id remains optional
nitrocode Nov 8, 2021
83c9368
zone_id remains optional
nitrocode Nov 8, 2021
e02b640
Auto Format
cloudpossebot Nov 8, 2021
46b8e50
posix_user => posix_users
nitrocode Nov 8, 2021
eb2259c
Set only one transition*
nitrocode Nov 8, 2021
025b978
Fix test using create_before_destroy = false
nitrocode Nov 8, 2021
2ebafd9
docs: Add security_group_change_before_destroy
nitrocode Nov 8, 2021
47c38e2
set availability_zone_name to list(string)
nitrocode Nov 8, 2021
b649e43
Auto Format
cloudpossebot Nov 8, 2021
877badf
Update docs/migration-0.30.1-0.32.x+.md
nitrocode Nov 8, 2021
71a2a43
Update main.tf
nitrocode Nov 8, 2021
7a9a842
Update variables.tf
nitrocode Nov 8, 2021
e99b14e
Revert availability_zone_name and kms_key_id to string type
Nuru Nov 9, 2021
2ca5da4
Auto Format
cloudpossebot Nov 9, 2021
58ea231
Add standard input `associated_security_group_ids`
Nuru Nov 10, 2021
8b1c4e7
Update docs/migration-0.30.1-0.32.x+.md
nitrocode Nov 10, 2021
934a263
Update docs/migration-0.30.1-0.32.x+.md
nitrocode Nov 10, 2021
d05be79
Fix README note
nitrocode Nov 10, 2021
4ad1343
Auto Format
cloudpossebot Nov 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

# Cloud Posse must review any changes to standard context definition,
# but some changes can be rubber-stamped.
**/*.tf @cloudposse/engineering @cloudposse/approvers
README.yaml @cloudposse/engineering @cloudposse/approvers
**/*.tf @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
README.yaml @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers

Expand Down
3 changes: 2 additions & 1 deletion .github/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ version-resolver:
- 'bugfix'
- 'bug'
- 'hotfix'
- 'no-release'
default: 'minor'

categories:
Expand Down Expand Up @@ -46,7 +47,7 @@ template: |

replacers:
# Remove irrelevant information from Renovate bot
- search: '/---\s+^#.*Renovate configuration(?:.|\n)*?This PR has been generated .*/gm'
- search: '/(?<=---\s+)+^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
replace: ''
# Remove Renovate bot banner image
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'
Expand Down
7 changes: 7 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ pull_request_rules:
changes_requested: true
approved: true
message: "This Pull Request has been updated, so we're dismissing all reviews."

- name: "close Pull Requests without files changed"
conditions:
- "#files=0"
actions:
close:
message: "This pull request has been automatically closed by Mergify because there are no longer any changes."
4 changes: 3 additions & 1 deletion .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
auto-format:
runs-on: ubuntu-latest
container: cloudposse/build-harness:slim-latest
container: cloudposse/build-harness:latest
steps:
# Checkout the pull request branch
# "An action in a workflow run can’t trigger a new workflow run. For example, if an action pushes code using
Expand All @@ -29,6 +29,8 @@ jobs:
- name: Auto Format
if: github.event.pull_request.state == 'open'
shell: bash
env:
GITHUB_TOKEN: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
run: make BUILD_HARNESS_PATH=/build-harness PACKAGES_PREFER_HOST=true -f /build-harness/templates/Makefile.build-harness pr/auto-format/host

# Commit changes (if any) to the PR branch
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@ name: auto-release
on:
push:
branches:
- master
- main
- master
- production

jobs:
publish:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
with:
publish: true
prerelease: false
config-name: auto-release.yml
env:
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
# Get PR from merged commit to master
- uses: actions-ecosystem/action-get-merged-pull-request@v1
id: get-merged-pull-request
with:
github_token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
with:
publish: ${{ !contains(steps.get-merged-pull-request.outputs.labels, 'no-release') }}
prerelease: false
config-name: auto-release.yml
env:
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/validate-codeowners.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Validate Codeowners
on:
workflow_dispatch:

pull_request:

jobs:
Expand Down
61 changes: 38 additions & 23 deletions README.md

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ related:
# Short description of this project
description: |-
Terraform module to provision an AWS [`EFS`](https://aws.amazon.com/efs/) Network File System.

**NOTE**: Release `0.32.0` contains breaking changes. To preserve the SG, follow the instructions in the [0.30.1 to 0.32.x+ migration path](./docs/migration-0.30.1-0.32.x+.md).

# How to use this project
usage: |-
Include this repository as a module in your existing terraform code:
Expand All @@ -51,14 +54,15 @@ usage: |-
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

namespace = "eg"
stage = "test"
name = "app"
region = "us-west-1"
vpc_id = var.vpc_id
subnets = var.private_subnets
security_groups = [var.security_group_id]
zone_id = var.aws_route53_dns_zone_id
namespace = "eg"
stage = "test"
name = "app"
region = "us-west-1"
vpc_id = var.vpc_id
subnets = var.private_subnets
zone_id = [var.aws_route53_dns_zone_id]

allowed_security_group_ids = [var.security_group_id]
}
```

Expand All @@ -82,3 +86,5 @@ contributors:
github: "joshmyers"
- name: "Vladimir Syromyatnikov"
github: "SweetOps"
- name: "RB"
github: "nitrocode"
60 changes: 60 additions & 0 deletions docs/migration-0.30.1-0.32.x+.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Migration from 0.30.1 to 0.32.x+

NOTE: This is not a migration guide from the pre-release versions 0.31.0 and 0.31.1

Version `0.32.0` of this module introduces changes that, without taking additional precautions, will cause the security group created by this module to be replaced with a new one. Note that the EFS file system will not be affected, all that will change is that the EFS mount targets will be moved to a new security group and there may be a brief period (likely only a few seconds) during which all connectivity is lost.

This is because of the newer version's reliance on the [terraform-aws-security-group](https://github.com/cloudposse/terraform-aws-security-group)
module for managing the module's security group. This changes the Terraform resource address.

To circumvent this, after bumping the module version to the newer version, make note of these changes.

* `transition_to_ia` is now a `list(string)` so pass in the single value as a list.
* `zone_id` is now a `list(string)` so pass in the single value as a list.
* `security_groups` is deprecated. Use `allowed_security_group_ids` instead.

For more information on why we use a `list(string)` instead of `string` for strings vars, see the SG 4.0 releae notes "Optional Inputs" section linked below.

Run a `terraform plan` to retrieve the resource addresses of the SG that Terraform would like to destroy, and the resource address of the SG which Terraform would like to create.

Make sure that the following variables are set since the original SG name had the suffix `-efs`.

* Setting `security_group_create_before_destroy = false` prevents using `name_prefix` on the SG resource
* Setting `security_group_name` to its "legacy" value will keep the Security Group from being replaced, and hence the underlying resource.

```hcl
security_group_create_before_destroy = false

# if not using context
security_group_name = ["<existing-sg-name>"]

# if using context
security_group_name = ["${module.this.context}-efs"]
```

Finally, change the resource address of the existing Security Group. The resources' source and destination addresses will vary based on how this module is used.

If the module's name is `efs`, here is an example set of `terraform state mv` commands to get started.

```bash
# required - move the security group resource
terraform state mv \
'module.efs.aws_security_group.efs[0]' \
'module.efs.module.security_group.aws_security_group.default[0]'
# optional - move the security group rules (may be different depending on usage)
terraform state mv \
'module.efs.aws_security_group_rule.ingress_security_groups[0]' \
'module.efs.module.security_group.aws_security_group_rule.keyed["_m[0]#[0]#sg#0"]'
terraform state mv \
'module.efs.aws_security_group_rule.egress[0]' \
'module.efs.module.security_group.aws_security_group_rule.keyed["_allow_all_egress_"]'
```

This will result in an plan that will only destroy SG Rules, but not the Security Group itself.

Please run a `terraform plan` to make sure there aren't other unexpected breaking changes.

## References

* https://github.com/cloudposse/terraform-aws-security-group/blob/c6e4156696ee28cad0cd927c82377fbd73156199/exports/security_group_inputs.tf#L71-L72
* https://github.com/cloudposse/terraform-aws-security-group/releases/tag/0.4.0
Loading