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.8k stars 9.15k forks source link

[Bug]: aws_kendra_index - Invalid address to set #31416

Closed johnjelinek closed 1 year ago

johnjelinek commented 1 year ago

Terraform Core Version

1.4.6

AWS Provider Version

4.67.0

Affected Resource(s)

Expected Behavior

Kendra index successfully created

Actual Behavior

Kendra index is created, but cannot persist to terraform state

Relevant Error/Panic Output Snippet

>╷
│ Error: Invalid address to set: []string{"user_group_resolution_configuration", "0", "user_group_resolution_configuration"}

Terraform Configuration Files

resource "aws_kendra_index" "chatalyst" {
  name        = local.name
  description = local.description
  edition     = "DEVELOPER_EDITION"
  role_arn    = module.kendra_role.iam_role_arn
  tags        = local.tags

  server_side_encryption_configuration {
    kms_key_id = data.aws_kms_alias.kendra.target_key_id
  }

  user_group_resolution_configuration {
    user_group_resolution_mode = "AWS_SSO"
  }
}

Steps to Reproduce

Create the resource, watch it fail to apply.

Debug Output

2023-05-15T19:45:38.237-0500 [DEBUG] provider.terraform-provider-aws_v4.67.0_x5: HTTP Response Received: @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.25/logging/logger.go:39 aws.operation=DescribeIndex http.response.header.content_type=application/x-amz-json-1.1 http.response.header.date="Tue, 16 May 2023 00:45:37 GMT" tf_resource_type=aws_kendra_index aws.region=us-west-2 aws.service=kendra http.duration=466 http.response.body="
{
  "Name": "redacted",
  "RoleArn": "arn:aws:iam:::role/redacted",
  "ServerSideEncryptionConfiguration": {
    "KmsKeyId": "arn:aws:kms:::redacted"
  },
  "Status": "ACTIVE",
  "UpdatedAt": 1.684195712022e9,
  "UserContextPolicy": "ATTRIBUTE_FILTER",
  "UserGroupResolutionConfiguration": { "UserGroupResolutionMode": "AWS_SSO" }
}"
2023-05-15T19:45:38.238-0500 [ERROR] provider.terraform-provider-aws_v4.67.0_x5: [ERROR] setting state: Invalid address to set: []string{"user_group_resolution_configuration", "0", "user_group_resolution_configuration"}
2023-05-15T19:45:38.238-0500 [TRACE] provider.terraform-provider-aws_v4.67.0_x5: Called downstream: tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=811045f1-1add-d2ae-c42a-a7a122c769fc tf_resource_type=aws_kendra_index tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.26.1/helper/schema/resource.go:1016 @module=sdk.helper_schema tf_mux_provider=*schema.GRPCProviderServer timestamp=2023-05-15T19:45:38.238-0500
2023-05-15T19:45:38.240-0500 [TRACE] provider.terraform-provider-aws_v4.67.0_x5: Received downstream response: @caller=github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:37 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=811045f1-1add-d2ae-c42a-a7a122c769fc tf_rpc=ReadResource tf_req_duration_ms=473 tf_resource_type=aws_kendra_index @module=sdk.proto diagnostic_error_count=1 diagnostic_warning_count=0 tf_proto_version=5.3 timestamp=2023-05-15T19:45:38.240-0500
2023-05-15T19:45:38.240-0500 [ERROR] provider.terraform-provider-aws_v4.67.0_x5: Response contains error diagnostic: tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto diagnostic_detail= tf_proto_version=5.3 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=811045f1-1add-d2ae-c42a-a7a122c769fc tf_resource_type=aws_kendra_index diagnostic_severity=ERROR diagnostic_summary="Invalid address to set: []string{"user_group_resolution_configuration", "0", "user_group_resolution_configuration"}" timestamp=2023-05-15T19:45:38.240-0500
2023-05-15T19:45:38.240-0500 [TRACE] provider.terraform-provider-aws_v4.67.0_x5: Served request: tf_req_id=811045f1-1add-d2ae-c42a-a7a122c769fc tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-go@v0.15.0/tfprotov5/tf5server/server.go:761 @module=sdk.proto tf_proto_version=5.3 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_kendra_index timestamp=2023-05-15T19:45:38.240-0500
2023-05-15T19:45:38.240-0500 [ERROR] vertex "aws_kendra_index.redacted" error: Invalid address to set: []string{"user_group_resolution_configuration", "0", "user_group_resolution_configuration"}
2023-05-15T19:45:38.240-0500 [TRACE] vertex "aws_kendra_index.redacted": visit complete, with errors
2023-05-15T19:45:38.240-0500 [TRACE] dag/walk: upstream of "root" errored, so skipping
2023-05-15T19:45:38.240-0500 [TRACE] vertex "aws_kendra_index.redacted (expand)": dynamic subgraph encountered errors: Invalid address to set: []string{"user_group_resolution_configuration", "0", "user_group_resolution_configuration"}
2023-05-15T19:45:38.240-0500 [ERROR] vertex "aws_kendra_index.redacted (expand)" error: Invalid address to set: []string{"user_group_resolution_configuration", "0", "user_group_resolution_configuration"}
2023-05-15T19:45:38.240-0500 [TRACE] vertex "aws_kendra_index.redacted (expand)": visit complete, with errors
2023-05-15T19:45:38.241-0500 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" errored, so skipping
2023-05-15T19:45:38.241-0500 [TRACE] dag/walk: upstream of "root" errored, so skipping
2023-05-15T19:45:38.241-0500 [TRACE] LoadSchemas: retrieving schema for provider type "registry.terraform.io/hashicorp/aws"
2023-05-15T19:45:38.241-0500 [TRACE] LoadSchemas: retrieving schema for provider type "registry.terraform.io/hashicorp/aws"

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

johnjelinek commented 1 year ago

Perhaps this is my problem? I'm spinning up Kendra in an organization member account.

Amazon Kendra currently does not support using UserGroupResolutionConfiguration with an AWS organization member account for your IAM Identity Center identity source. You must create your index in the management account for the organization in order to use UserGroupResolutionConfiguration. (source)

github-actions[bot] commented 1 year ago

This functionality has been released in v5.1.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 1 year 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.