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

Bump s3-bucket::modernisation-platform-terraform-s3-bucket from 7.1.0 to 8.2.0 in /terraform/environments/apex #7807

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Sep 18, 2024

Bumps s3-bucket::modernisation-platform-terraform-s3-bucket from 7.1.0 to 8.2.0.

Release notes

Sourced from s3-bucket::modernisation-platform-terraform-s3-bucket's releases.

v8.2.0

What's New

The prior implementation of aws_s3_bucket_logging caused issues where bucket names for logs were strings known only after a terraform apply. This PR moves the logic to use a for_eachwith options to preserve backwards compatibility in the use of var.log_bucket_name. A new variable - var.log_buckets - takes a map of bucket attributes and creates aws_s3_bucket_logging resources for each log bucket.

To reference a bucket from a s3 bucket module in the same tf:

module "s3_with_log_bucket" {
  log_buckets      = tomap({ "main_log_bucket" : module.s3_log_bucket.bucket })
  log_prefix       = "logs/"
}

To refer to another bucket by name:

module "s3_with_log_bucket" { 
  log_bucket       = "log-bucket"
  log_prefix = "logs/"
}

Or multiple buckets by name:

module "s3_with_log_bucket" { 
  log_bucket_names = toset(["log-bucket", "other-log-bucket"])
  log_prefix = "logs/"
}

What's Changed

... (truncated)

Commits

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Bumps [s3-bucket::modernisation-platform-terraform-s3-bucket](https://github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket) from 7.1.0 to 8.2.0.
- [Release notes](https://github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket/releases)
- [Commits](ministryofjustice/modernisation-platform-terraform-s3-bucket@v7.1.0...v8.2.0)

---
updated-dependencies:
- dependency-name: s3-bucket::github::ministryofjustice/modernisation-platform-terraform-s3-bucket::v7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Sep 18, 2024
@dependabot dependabot bot requested a review from a team as a code owner September 18, 2024 00:33
@dependabot dependabot bot added the terraform Pull requests that update Terraform code label Sep 18, 2024
@dependabot dependabot bot requested review from a team as code owners September 18, 2024 00:33
@github-actions github-actions bot added the environments-repository Used to exclude PRs from this repo in our Slack PR update label Sep 18, 2024
Copy link
Contributor

Trivy Scan Failed

Show Output ```hcl

Trivy will check the following folders:
terraform/environments/apex/modules/alb


Running Trivy in terraform/environments/apex/modules/alb
2024-09-18T00:35:22Z INFO [db] Need to update DB
2024-09-18T00:35:22Z INFO [db] Downloading DB... repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-18T00:35:24Z INFO [vuln] Vulnerability scanning is enabled
2024-09-18T00:35:24Z INFO [misconfig] Misconfiguration scanning is enabled
2024-09-18T00:35:24Z INFO Need to update the built-in policies
2024-09-18T00:35:24Z INFO Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-18T00:35:24Z INFO [secret] Secret scanning is enabled
2024-09-18T00:35:24Z INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-18T00:35:24Z INFO [secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-18T00:35:24Z INFO [terraform scanner] Scanning root module file_path="."
2024-09-18T00:35:24Z WARN [terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly. module="root" variables="account_number, acm_cert_domain_name, alb_ssl_policy, application_name, business_unit, enable_deletion_protection, environment, healthcheck_healthy_threshold, healthcheck_interval, healthcheck_path, healthcheck_protocol, healthcheck_timeout, healthcheck_unhealthy_threshold, idle_timeout, listener_port, listener_protocol, private_subnets, public_subnets, region, security_group_ingress_from_port, security_group_ingress_protocol, security_group_ingress_to_port, stickiness_cookie_duration, stickiness_enabled, stickiness_type, tags, target_group_deregistration_delay, target_group_port, target_group_protocol, vpc_all, vpc_id"
2024-09-18T00:35:24Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="aws_route53_record.external_lb_validation_core_network_services" value="cty.NilVal"
2024-09-18T00:35:24Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="aws_route53_record.external_lb_validation_core_vpc" value="cty.NilVal"
2024-09-18T00:35:24Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="aws_route53_record.external_lb_validation_self" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.expiration" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.transition" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.principals" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.condition" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.expiration" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.transition" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.principals" value="cty.NilVal"
2024-09-18T00:35:25Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket[0].dynamic.condition" value="cty.NilVal"
2024-09-18T00:35:25Z INFO [terraform executor] Ignore finding rule="aws-elb-alb-not-public" range="main.tf:242"
2024-09-18T00:35:25Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v8.2.0/main.tf:16-27"
2024-09-18T00:35:25Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v8.2.0/main.tf:16-27"
2024-09-18T00:35:25Z INFO [terraform executor] Ignore finding rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v8.2.0/main.tf:187-197"
2024-09-18T00:35:25Z INFO Number of language-specific files num=0
2024-09-18T00:35:25Z INFO Detected config files num=3

main.tf (terraform)

Tests: 8 (SUCCESSES: 6, FAILURES: 1, EXCEPTIONS: 1)
Failures: 1 (HIGH: 0, CRITICAL: 1)

CRITICAL: Security group rule allows egress to multiple public internet addresses.
════════════════════════════════════════
Opening up ports to connect out to the public internet is generally to be avoided. You should restrict access to IP addresses or ranges that are explicitly required where possible.

See https://avd.aquasec.com/misconfig/avd-aws-0104
────────────────────────────────────────
main.tf:289
via main.tf:284-291 (content)
via main.tf:282-292 (dynamic.egress["lb_egress"])
via main.tf:264-293 (aws_security_group.lb)
────────────────────────────────────────
264 resource "aws_security_group" "lb" {
...
289 [ cidr_blocks = lookup(egress.value, "cidr_blocks", null)
...
293 }
────────────────────────────────────────

trivy_exitcode=1

</details> #### `Checkov Scan` Failed
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/apex/modules/alb

*****************************

Running Checkov in terraform/environments/apex/modules/alb
Excluding the following checks: CKV_GIT_1,CKV_AWS_126,CKV2_AWS_38,CKV2_AWS_39
2024-09-18 00:35:27,583 [MainThread  ] [WARNI]  Failed to download module github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v8.2.0:None (for external modules, the --download-external-modules flag is required)
terraform scan results:

Passed checks: 25, Failed checks: 4, Skipped checks: 3

Check: CKV_TF_1: "Ensure Terraform module sources use a commit hash"
	FAILED for resource: s3-bucket[0]
	File: /main.tf:124-179
	Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/supply-chain-policies/terraform-policies/ensure-terraform-module-sources-use-git-url-with-commit-hash-revision

		Code lines for this resource are too many. Please use IDE of your choice to review the file.
Check: CKV_AWS_149: "Ensure that Secrets Manager secret is encrypted using KMS CMK"
	FAILED for resource: aws_secretsmanager_secret.cloudfront
	File: /main.tf:303-306
	Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/ensure-that-secrets-manager-secret-is-encrypted-using-kms

		303 | resource "aws_secretsmanager_secret" "cloudfront" {
		304 |   name        = "cloudfront-v1-secret-${var.application_name}"
		305 |   description = "Simple secret created by AWS CloudFormation to be shared between ALB and CloudFront"
		306 | }

Check: CKV_AWS_233: "Ensure Create before destroy for ACM certificates"
	FAILED for resource: aws_acm_certificate.external_lb
	File: /main.tf:658-668
	Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-networking-policies/ensure-aws-acm-certificate-enables-create-before-destroy

		658 | resource "aws_acm_certificate" "external_lb" {
		659 | 
		660 |   domain_name               = var.acm_cert_domain_name
		661 |   validation_method         = "DNS"
		662 |   subject_alternative_names = var.environment == "production" ? null : ["${var.application_name}.${var.business_unit}-${var.environment}.${var.acm_cert_domain_name}"]
		663 |   tags                      = var.tags
		664 |   # TODO Set prevent_destroy to true to stop Terraform destroying this resource in the future if required
		665 |   lifecycle {
		666 |     prevent_destroy = false
		667 |   }
		668 | }

Check: CKV2_AWS_57: "Ensure Secrets Manager secrets should have automatic rotation enabled"
	FAILED for resource: aws_secretsmanager_secret.cloudfront
	File: /main.tf:303-306
	Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/bc-aws-2-57

		303 | resource "aws_secretsmanager_secret" "cloudfront" {
		304 |   name        = "cloudfront-v1-secret-${var.application_name}"
		305 |   description = "Simple secret created by AWS CloudFormation to be shared between ALB and CloudFront"
		306 | }


checkov_exitcode=1

CTFLint Scan Failed

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.9.1)
tflint will check the following folders:
terraform/environments/apex/modules/alb

*****************************

Running tflint in terraform/environments/apex/modules/alb
Excluding the following checks: terraform_unused_declarations
3 issue(s) found:

Warning: Missing version constraint for provider "random" in `required_providers` (terraform_required_providers)

  on terraform/environments/apex/modules/alb/main.tf line 298:
 298: resource "random_password" "cloudfront" {

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.9.1/docs/rules/terraform_required_providers.md

Warning: Missing version constraint for provider "null" in `required_providers` (terraform_required_providers)

  on terraform/environments/apex/modules/alb/main.tf line 532:
 532: resource "null_resource" "always_run" {

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.9.1/docs/rules/terraform_required_providers.md

Warning: `environment` variable has no type (terraform_typed_variables)

  on terraform/environments/apex/modules/alb/variables.tf line 123:
 123: variable "environment" {}

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.9.1/docs/rules/terraform_typed_variables.md

tflint_exitcode=2

Trivy Scan Failed

Show Output
*****************************

Trivy will check the following folders:
terraform/environments/apex/modules/alb

*****************************

Running Trivy in terraform/environments/apex/modules/alb
2024-09-18T00:35:22Z	INFO	[db] Need to update DB
2024-09-18T00:35:22Z	INFO	[db] Downloading DB...	repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-18T00:35:24Z	INFO	[vuln] Vulnerability scanning is enabled
2024-09-18T00:35:24Z	INFO	[misconfig] Misconfiguration scanning is enabled
2024-09-18T00:35:24Z	INFO	Need to update the built-in policies
2024-09-18T00:35:24Z	INFO	Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-18T00:35:24Z	INFO	[secret] Secret scanning is enabled
2024-09-18T00:35:24Z	INFO	[secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-18T00:35:24Z	INFO	[secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-18T00:35:24Z	INFO	[terraform scanner] Scanning root module	file_path="."
2024-09-18T00:35:24Z	WARN	[terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly.	module="root" variables="account_number, acm_cert_domain_name, alb_ssl_policy, application_name, business_unit, enable_deletion_protection, environment, healthcheck_healthy_threshold, healthcheck_interval, healthcheck_path, healthcheck_protocol, healthcheck_timeout, healthcheck_unhealthy_threshold, idle_timeout, listener_port, listener_protocol, private_subnets, public_subnets, region, security_group_ingress_from_port, security_group_ingress_protocol, security_group_ingress_to_port, stickiness_cookie_duration, stickiness_enabled, stickiness_type, tags, target_group_deregistration_delay, target_group_port, target_group_protocol, vpc_all, vpc_id"
2024-09-18T00:35:24Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="aws_route53_record.external_lb_validation_core_network_services" value="cty.NilVal"
2024-09-18T00:35:24Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="aws_route53_record.external_lb_validation_core_vpc" value="cty.NilVal"
2024-09-18T00:35:24Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="aws_route53_record.external_lb_validation_self" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.expiration" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.transition" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.principals" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.condition" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.expiration" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.transition" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.principals" value="cty.NilVal"
2024-09-18T00:35:25Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket[0].dynamic.condition" value="cty.NilVal"
2024-09-18T00:35:25Z	INFO	[terraform executor] Ignore finding	rule="aws-elb-alb-not-public" range="main.tf:242"
2024-09-18T00:35:25Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v8.2.0/main.tf:16-27"
2024-09-18T00:35:25Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v8.2.0/main.tf:16-27"
2024-09-18T00:35:25Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v8.2.0/main.tf:187-197"
2024-09-18T00:35:25Z	INFO	Number of language-specific files	num=0
2024-09-18T00:35:25Z	INFO	Detected config files	num=3

main.tf (terraform)
===================
Tests: 8 (SUCCESSES: 6, FAILURES: 1, EXCEPTIONS: 1)
Failures: 1 (HIGH: 0, CRITICAL: 1)

CRITICAL: Security group rule allows egress to multiple public internet addresses.
════════════════════════════════════════
Opening up ports to connect out to the public internet is generally to be avoided. You should restrict access to IP addresses or ranges that are explicitly required where possible.

See https://avd.aquasec.com/misconfig/avd-aws-0104
────────────────────────────────────────
 main.tf:289
   via main.tf:284-291 (content)
    via main.tf:282-292 (dynamic.egress["lb_egress"])
     via main.tf:264-293 (aws_security_group.lb)
────────────────────────────────────────
 264   resource "aws_security_group" "lb" {
 ...   
 289 [       cidr_blocks     = lookup(egress.value, "cidr_blocks", null)
 ...   
 293   }
────────────────────────────────────────


trivy_exitcode=1

Copy link
Contributor

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Nov 18, 2024
@wullub wullub closed this Dec 2, 2024
@wullub wullub deleted the dependabot/terraform/terraform/environments/apex/s3-bucket--github--ministryofjustice/modernisation-platform-terraform-s3-bucket--v7.1.0-8.2.0 branch December 2, 2024 15:36
Copy link
Contributor Author

dependabot bot commented on behalf of github Dec 2, 2024

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file environments-repository Used to exclude PRs from this repo in our Slack PR update Stale terraform Pull requests that update Terraform code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant