hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.16k forks source link

[Bug]: aws_inspector2_enabler fails to update resources in regions with limited feature sets. #38845

Closed saefty closed 1 month ago

saefty commented 2 months ago

Terraform Core Version

1.9.4

AWS Provider Version

5.620

Affected Resource(s)

  # module.eu-west-3.aws_inspector2_enabler.this is tainted, so must be replaced
-/+ resource "aws_inspector2_enabler" "this" {
      ~ id             = "xxxx-EC2:ECR" -> (known after apply)
      ~ resource_types = [
          - "LAMBDA",
            # (2 unchanged elements hidden)
        ]
        # (1 unchanged attribute hidden)
    }

Expected Behavior

Scan configuration is updated in place without a destroy

Actual Behavior

ā”‚ Error: deleting AWS Inspector Enabler (REDACTEDACCOUNTID-EC2:ECR): operation error Inspector2: Disable, https response error StatusCode: 403, RequestID: [REDACTED], AccessDeniedException: Lambda code scanning is not supported in eu-west-3

Relevant Error/Panic Output Snippet

AWS Inspector in eu-west-3 does not support lambda code scanning. Somehow the provider tries to touch the config regardless of what I try: update, apply, destroy

Terraform Configuration Files

the snippet below is executed in all regions within the audit account. The audit account is the delegated admin for aws inspector

data "aws_region" "current" {}

locals {
  inspector2_enabled = [
    "EC2",
    "ECR",
    "LAMBDA",
    "LAMBDA_CODE",
  ]
  inspector2_enabled_euw_3 = [
    "EC2",
    "ECR",
    "LAMBDA",
  ] // Paris does not support Lambda Code (2024-08-13)
}

resource "aws_inspector2_enabler" "this" {
  account_ids    = [data.aws_caller_identity.current.account_id]
  resource_types = data.aws_region.current.name == "eu-west-3" ? local.inspector2_enabled_euw_3 : local.inspector2_enabled
}

Steps to Reproduce

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 2 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

github-actions[bot] commented 1 month ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] commented 1 month ago

This functionality has been released in v5.69.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] commented 2 days ago

I'm going to lock this issue because it has been closed for 30 days ā³. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.