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.74k stars 9.1k forks source link

Lake Formation managed location with Terraform is removed from LakeFormationDataAccessPolicyForS3 policy when manually registering other locations afterwards #24570

Closed xduran-at-wiris closed 3 months ago

xduran-at-wiris commented 2 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

$ terraform -v
Terraform v1.1.9
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v4.10.0

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.1"
    }
  }
  backend "s3" {}
}

provider "aws" {
  profile = "default"
}

resource "aws_s3_bucket" "test" {
  bucket = "tf-test-bucket"
}

resource "aws_lakeformation_data_lake_settings" "test" {
  admins = ["arn:aws:iam::<account_id>:role/<role_name>"]

  create_database_default_permissions {
    permissions = ["ALL"]
    principal   = "IAM_ALLOWED_PRINCIPALS"
  }

  create_table_default_permissions {
    permissions = ["ALL"]
    principal   = "IAM_ALLOWED_PRINCIPALS"
  }
}

resource "aws_lakeformation_resource" "test" {
  arn      = aws_s3_bucket.test.arn
}

Expected Behavior

LakeFormationDataAccessPolicyForS3 policy has references to all locations registered with Lake Formation.

Actual Behavior

LakeFormationDataAccessPolicyForS3 is updated as expected after applying the changes. The problem is that the registered locations with Terraform are removed automatically from LakeFormationDataAccessPolicyForS3 after manually registering another location on Lake Formation.

Steps to Reproduce

  1. terraform apply
  2. Manually register another location on Lake Formation
github-actions[bot] commented 4 months ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

github-actions[bot] commented 2 months 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.