hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
264 stars 121 forks source link

awscc_lakeformation_principal_permissions : terraform apply error #1280

Closed wellsiau-aws closed 10 months ago

wellsiau-aws commented 1 year ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

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.

resource "awscc_lakeformation_principal_permissions" "sample" {
  principal = {
    data_lake_principal_identifier = "arn:aws:iam::204034886740:role/Admin"
  }

  resource = {
    database = {
      catalog_id = "204034886740"
      name       = "default"
    }
  }

  permissions                   = ["CREATE_TABLE", "ALTER", "DROP", "DESCRIBE"]
  permissions_with_grant_option = ["CREATE_TABLE", "ALTER", "DROP", "DESCRIBE"]
}

Debug Output

Plan: 1 to add, 0 to change, 0 to destroy. awscc_lakeformation_principal_permissions.sample: Creating... β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.catalog. All values must be known after apply, so this is always a bug in β”‚ the provider and should be reported in the provider's own repository. Terraform will still save the other known object β”‚ values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.principal_identifier. All values must be known after apply, so this is β”‚ always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the other β”‚ known object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource.catalog. All values must be known after apply, so this is always β”‚ a bug in the provider and should be reported in the provider's own repository. Terraform will still save the other known β”‚ object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource.data_cells_filter. All values must be known after apply, so this β”‚ is always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the β”‚ other known object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource.data_location. All values must be known after apply, so this is β”‚ always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the other β”‚ known object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource.lf_tag. All values must be known after apply, so this is always a β”‚ bug in the provider and should be reported in the provider's own repository. Terraform will still save the other known β”‚ object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource.lf_tag_policy. All values must be known after apply, so this is β”‚ always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the other β”‚ known object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource.table. All values must be known after apply, so this is always a β”‚ bug in the provider and should be reported in the provider's own repository. Terraform will still save the other known β”‚ object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource.table_with_columns. All values must be known after apply, so this β”‚ is always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the β”‚ other known object values in the state. β•΅ β•· β”‚ Error: Provider returned invalid result object after apply β”‚ β”‚ After the apply operation, the provider still indicated an unknown value for β”‚ awscc_lakeformation_principal_permissions.sample.resource_identifier. All values must be known after apply, so this is β”‚ always a bug in the provider and should be reported in the provider's own repository. Terraform will still save the other β”‚ known object values in the state. β•΅ β•· β”‚ Error: AWS SDK Go Service Operation Unsuccessful β”‚ β”‚ with awscc_lakeformation_principal_permissions.sample, β”‚ on main.tf line 1, in resource "awscc_lakeformation_principal_permissions" "sample": β”‚ 1: resource "awscc_lakeformation_principal_permissions" "sample" { β”‚ β”‚ Calling Cloud Control API service GetResource operation returned: operation error CloudControl: GetResource, https response β”‚ error StatusCode: 400, RequestID: 6977755c-84be-4b34-a88d-671a1ef02e14, api error ValidationException: When specifying the β”‚ identifier as JSON, you must specify exactly one identifier from [[/properties/PrincipalIdentifier, β”‚ /properties/ResourceIdentifier]], and no additional properties can be specified

Expected Behavior

terraform apply should complete succesfully

Actual Behavior

terraform apply failed and resource tained

Steps to Reproduce

  1. terraform apply
wellsiau-aws commented 1 year ago

This might be relevant, the subsequent terraform plan output:

awscc_lakeformation_principal_permissions.sample: Refreshing state... [id={"DataLakePrincipalIdentifier":"arn:aws:iam::204034886740:role/Admin"}|{"Catalog":null,"Database":{"CatalogId":"204034886740","Name":"default"},"Table":null,"TableWithColumns":null,"DataLocation":null,"DataCellsFilter":null,"LFTag":null,"LFTagPolicy":null}]

Planning failed. Terraform encountered an error while generating this plan.

β•·
β”‚ Error: AWS SDK Go Service Operation Unsuccessful
β”‚ 
β”‚   with awscc_lakeformation_principal_permissions.sample,
β”‚   on main.tf line 1, in resource "awscc_lakeformation_principal_permissions" "sample":
β”‚    1: resource "awscc_lakeformation_principal_permissions" "sample" {
β”‚ 
β”‚ Calling Cloud Control API service GetResource operation returned: operation error CloudControl: GetResource, https response
β”‚ error StatusCode: 400, RequestID: 652abd06-2797-4a72-ad0d-db42011dd4f6, api error ValidationException: When specifying the
β”‚ identifier as JSON, you must specify exactly one identifier from [[/properties/PrincipalIdentifier,
β”‚ /properties/ResourceIdentifier]], and no additional properties can be specified

Interestingly, the id attribute on the terraform state contains the entire READ response:

{
  "version": 4,
  "terraform_version": "1.4.2",
   ...
  "resources": [
    {
      "mode": "managed",
      "type": "awscc_lakeformation_principal_permissions",
      "name": "sample",
      "provider": "provider[\"registry.terraform.io/hashicorp/awscc\"]",
      "instances": [
        {
          "status": "tainted",
          "schema_version": 1,
          "attributes": {
            "catalog": null,
            "id": "{\"DataLakePrincipalIdentifier\":\"arn:aws:iam::204034886740:role/Admin\"}|{\"Catalog\":null,\"Database\":{\"CatalogId\":\"204034886740\",\"Name\":\"default\"},\"Table\":null,\"TableWithColumns\":null,\"DataLocation\":null,\"DataCellsFilter\":null,\"LFTag\":null,\"LFTagPolicy\":null}",
            "permissions": [
              "CREATE_TABLE",
              "ALTER",
              "DROP",
              "DESCRIBE"
            ],
            ... <redacted>
}