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

Missing field in google_firestore_field import #17313

Comments

@remko
Copy link

remko commented Feb 19, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally
    to expedite investigation and resolution of this issue.

Terraform Version

Terraform v1.5.7
on darwin_arm64

  • provider registry.terraform.io/hashicorp/google v5.16.0
  • provider registry.terraform.io/hashicorp/google-beta v5.16.0

Affected Resource(s)

google_firestore_field

Terraform Configuration

resource "google_firestore_field" "BatchOperation_expiresAt" {
      project    = "my-project-id"
      database   = "(default)"
      collection = "BatchOperation"
      field      = "expiresAt"
      ttl_config {}
}

Debug Output

No response

Expected Behavior

After importing the existing TTL using terraform import 'google_firestore_field.BatchOperation_expiresAt' 'projects/my-project-id/databases/(default)/collectionGroups/BatchOperation/fields/expiresAt, I would have expected no changes when doing a terraform plan.

Actual Behavior

Terraform said it was going to apply the following change:

# google_firestore_field.BatchOperation_expiresAt will be updated in-place
~ resource "google_firestore_field" "BatchOperation_expiresAt" {
    + field      = "expiresAt"

Steps to reproduce

  1. Use cloud console to create a TTL policy on a Firestore in Datastore model
  2. Import it using terraform import 'google_firestore_field.BatchOperation_expiresAt' 'projects/my-project-id/databases/(default)/collectionGroups/BatchOperation/fields/expiresAt
  3. Run terraform plan

Important Factoids

This is the output of terraform state show:

> terraform state show google_firestore_field.BatchOperation_expiresAt
# google_firestore_field.BatchOperation_expiresAt:
resource "google_firestore_field" "BatchOperation_expiresAt" {
    collection = "BatchOperation"
    database   = "(default)"
    id         = "projects/my-project-id/databases/(default)/collectionGroups/BatchOperation/fields/expiresAt"
    name       = "projects/my-project-id/databases/(default)/collectionGroups/BatchOperation/fields/expiresAt"
    project    = "my-project-id"

    timeouts {}

    ttl_config {
        state = "ACTIVE"
    }

}

The field seems to be missing from the config.

References

No response

b/327218865

@remko remko added the bug label Feb 19, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/firestore-dataplane labels Feb 19, 2024
@roaks3
Copy link
Collaborator

roaks3 commented Feb 27, 2024

Confirmed issue during the plan. It appears that immediately after import, the Terraform state has a null field, which is incorrect. There is likely some issue with the custom import code (it actually looks like there is a custom import defined for this resource, but it is not being used).

@roaks3 roaks3 removed the forward/review In review; remove label to forward label Feb 27, 2024
pcostell added a commit to pcostell/magic-modules that referenced this issue Jul 16, 2024
Fixes hashicorp/terraform-provider-google#17313.

Verified with a local `terraform import` followed by `terraform plan`.
pcostell added a commit to pcostell/magic-modules that referenced this issue Jul 16, 2024
Fixes hashicorp/terraform-provider-google#17313.

Verified with a local `terraform import` followed by `terraform plan`.
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.