-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Bug]: aws_grafana_workspace_api_key doesn't renew #27123
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Apologies if this is posted in the wrong place, please let me know where to post if so. SummaryWhen aws_grafana_workspace_api_key expires (required field seconds_to_live) it stops grafana provider from working completely. Can't even WorkAroundThe only work around I found is to remove the old expired key, rename, and create new one:
change name of the key and
|
In Grafanas terraform example, the api key doesn't require expiration date: |
Seems like should be the case, maybe AWS made it so for security reasons 🤔 It would be great to lift this constraint |
Related #27043 |
a workaround i've resorted to is an external data source that runs a script to create a key before each run. (deleting a key with the same name first, if one exists)
additionally, in the above example, if var.create_grafana_workspace = true, the plan sets an output value of the grafana workspace id, which can then be referenced in a future plan that may want to destroy the workspace by setting var.create_grafana_workspace = false. in this scenario, the workspace information isn't available from the previously created resource because the count is now 0. and we need the workspace id in order to create a new key to initialize the grafana provider, so that it can read and destroy any resources that use this provider. so this works around expiring keys, and the case where you want to destroy a workspace that also had additional things added to the workspace by the grafana provider. but it's definitely not ideal |
Any progress on the issue? |
@brianmaresca, where this script can be found? |
@dievri it's just a custom python script takes in the inputs defined in |
I found a quite easy workaround. You just have to make sure one of the resource attributes' value changes on each run. I used timestamp built-in function and append it to
|
EDIT:
undesired. I wonder how so many people use it in production without this affecting their workflow. |
watch out with these workarounds - as mentioned here, AWS will charge you a monthly fee for each API key, so $8 per terraform run. |
@dannygoulder i think you are billed for active keys. so if you're creating a new key each terraform run without cleaning up the keys made from previous runs, then i think you would be getting hit with a charge per key. but if you delete and recreate the key each time i don't think there would be an additional charge. im still not 100% sure of this, not only is the api key pricing unclear and buried in the pricing docs, in the aws user guides and the aws terraform docs there are detailed instructions on the various ways to create an api key. of course they both conveniently have no reminder that you will be charged every single time you follow those steps. |
@brianmaresca @dannygoulder unfortunately, they will charge you for every created API key (I'm talking about NOT enterprise version). Any key which was used at least one time is active for 30 days. |
@timurv-da i spoke with an AWS representative and asked point blank "are you charged every time you create an api key". response:
I also shared this github issue with the AWS rep, and she said that she will try to have someone respond here with the pricing clarification. 🤞 |
@brianmaresca I also had a conversation with AWS representative =) |
The service accounts could solve the problem but there isn't a This solution can be the fix for now but we also know that Grafana is about to deprecate API keys which is a big problem. That's why having a service account resource would be the final fix for these problems. |
Terraform Core Version
1.3.0
AWS Provider Version
4.32.0
Affected Resource(s)
Expected Behavior
New key is created and terraform shows plan
Actual Behavior
Or if i have the grafana_data_source block also:
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
terraform apply
wait for the key to expire
terraform plan
Debug Output
No response
Panic Output
No response
Important Factoids
I'm using terraform to create aws_managed_grafana, and then creating an api key there that is required to have an expiration date. Once it expires, the grafana provider that i'm trying to use to configure this aws_managed_grafana instance, stops working. The whole plan stops working.
References
No response
Would you like to implement a fix?
No
The text was updated successfully, but these errors were encountered: