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

Service Account change in google_bigquery_data_transfer_config forces replacement #14123

Closed
giulianobr opened this issue Mar 28, 2023 · 9 comments

Comments

@giulianobr
Copy link

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

1.4.2

Affected Resource(s)

  • google_bigquery_data_transfer_config

Google Provider version

4.59

Terraform Configuration Files

In the resource "google_bigquery_data_transfer_config" if you change the service_account_name after you already applied your tf plan, the new apply will force replace the Scheduled Query.

Why is this happening, if we can replace the service account in a scheduled query using the following cmd:

bq update \
--transfer_config \
--update_credentials \
--service_account_name=service.account@gcpproject.iam.gserviceaccount.com \
projects/xxxxxxxx/locations/us/transferConfigs/xxxxxxxx-xxxxx-xxxx-xxxx-xxxxx

Thanks,

@giulianobr giulianobr added the bug label Mar 28, 2023
@edwardmedia edwardmedia self-assigned this Mar 28, 2023
@edwardmedia
Copy link
Contributor

Looks like it could take below updateMask

query: ?updateMask=transfer_config.scheduleOptions%2Cservice_account_name&serviceAccountName=myaccount%40myproject.iam.gserviceaccount.com&%24.xgafv=2&alt=json

@edwardmedia edwardmedia assigned zli82016 and unassigned edwardmedia Mar 29, 2023
@zli82016
Copy link
Collaborator

@giulianobr , can you please provide the config if possible? Thanks.

@giulianobr
Copy link
Author

Hi, I'm using a simple one, like this:

resource "google_bigquery_data_transfer_config" "temp_query" {
  display_name         = "Temp Scheduled Query to test owner change"
  location             = "US"
  data_source_id       = "scheduled_query"
  schedule             = "every 15 minutes"
  service_account_name = google_service_account.sa_bq_usage_queries.email
  email_preferences {
    enable_failure_email = true
  }
  params = {
    query = <<EOT
        select current_date()
        EOT
  }
}

For testing purpose, try to create it without the service_account_name, apply the code, then include it again and apply it. You will see Terraform will force-replace the resource, instead of, in place modification.

@zli82016 zli82016 added the persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work label Apr 3, 2023
@zli82016
Copy link
Collaborator

zli82016 commented Apr 3, 2023

It looks like setting the update_mask accordingly for a url_param_only is currently not supported in magic-modules and needs a workaround.

https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/products/bigquerydatatransfer/Config.yaml#L60

@zli82016 zli82016 removed their assignment Apr 3, 2023
@giulianobr
Copy link
Author

So, there's a way to solve it ? @zli82016 and @edwardmedia

@zli82016 zli82016 removed the bug label Apr 5, 2023
@zli82016
Copy link
Collaborator

zli82016 commented Apr 5, 2023

Unfortunately, I do not find a way to solve it.

@rileykarson rileykarson added enhancement size/m and removed persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work labels Apr 10, 2023
@rileykarson rileykarson added this to the Goals milestone Apr 10, 2023
@rileykarson
Copy link
Collaborator

Note: Looks harder than size/s, marking size/m. Update support is considered a feature request, not a bug.

@trodge
Copy link
Collaborator

trodge commented May 1, 2023

b/280337862

@github-actions
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 Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants