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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

service_account_name is set to null on terraform import for bigquery transfer config #12483

Open
anderssonpof opened this issue Sep 7, 2022 · 2 comments
Labels
forward/linked persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work service/bigquery size/s
Milestone

Comments

@anderssonpof
Copy link

anderssonpof commented Sep 7, 2022

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 the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.2.4
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v4.34.0
+ provider registry.terraform.io/hashicorp/google-beta v4.34.0

Affected Resource(s)

google_bigquery_data_transfer_config

Expected Behavior

In resulting state file, location should be set appropriately - for eg. "service_account_name" : bq-transfer-sa@<PROJECT_ID>dev.iam.gserviceaccount.com

Actual Behavior

After import, service account name in state is set to null: "service_account_name": null

This causes an issue, as now terraform plan shows it would need to recreate the resource:

$ terraform plan
...
+ service_account_name     = "bq-transfer-sa@<PROJECT_ID>.iam.gserviceaccount.com" # forces replacement
...

Steps to Reproduce

  1. create resource google_bigquery_data_transfer_config with service account specified
   bq mk \
      --transfer_config \
      --project_id="${PROJECT_ID}" \
      --data_source=google_cloud_storage \
      --display_name="${NAME}" \
      --target_dataset="${TARGET_DATASET}" \
      --service_account_name="${BQ_TRANSFER_SERVICE_ACCOUNT}" \
      --params="${PARAMS}" \
      --schedule="${TRANSFER_SCHEDULE}"
  1. import resource google_bigquery_data_transfer_config
  2. terraform plan

b/321386847

@edwardmedia edwardmedia self-assigned this Sep 7, 2022
@edwardmedia
Copy link
Contributor

@melinath would you call this is an api issue? Below is where the service_account is in the response body. ownerInfo is not defined anywhere in the resource.

{
  ...
  "ownerInfo": {
    "email": "myserviceaccount@smyproject.iam.gserviceaccount.com"
  }
}

@edwardmedia edwardmedia assigned melinath and unassigned edwardmedia Sep 8, 2022
@melinath
Copy link
Collaborator

hm, that's weird. serviceAccount is what you use to set this value on create but on read it shows up in ownerInfo.... but it looks like the ownerInfo might also be a non-service-account user? So I don't think we can always assume that field is a service account. But maybe it would still make sense to map it over on import specifically?

I'm not sure what the best thing to do here is.

@melinath melinath assigned edwardmedia and unassigned melinath Sep 12, 2022
@edwardmedia edwardmedia added the persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work label Sep 25, 2022
@edwardmedia edwardmedia removed their assignment Sep 25, 2022
@rileykarson rileykarson removed the bug label Mar 6, 2023
@rileykarson rileykarson added this to the Goals milestone Mar 20, 2023
@github-actions github-actions bot added service/bigquery forward/review In review; remove label to forward labels Aug 17, 2023
@melinath melinath removed the forward/review In review; remove label to forward label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forward/linked persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work service/bigquery size/s
Projects
None yet
Development

No branches or pull requests

5 participants