You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Support secret creation for github actions #271
it would be super cool to be able to set secrets for actions through terraform while creating a repository. ;)
ty,
g. (happy action user)
Reacted by Guillaume Jambet, Martins Sipenko, RolfJordi, Tommy Maintz, Nathaniel (Nate) Ram, Joakim Bakke Hellum, Rolands Usāns, Luke Griffith, Iiro Niinikoski, Stas Belov and 47 more
Reacted by Guillaume Jambet, FlorinMugurEndava, Rolands Usāns, Iiro Niinikoski, Yassine Chbani, Andreas Böhm, Jon, Brian Macauley, Blake Kostner, Jason Maurer and 8 more
Reacted by Oliver Grimm, Iiro Niinikoski, Stuart Auld and Gareth Jones
Is there a way to provide ciphertexts in terraform and supply the key via an environment variable?
I can imagine it's problematic to store plaintext github secrets in terraform files ... which might be located on github again.
@hazcod I think one option would be that resource accepts two conflicting arguments - secret and encrypted_secret, The secret could be used to pass plain text value which would be encrypted by terraform using GitHubs public key. The encrypted_secret would accept already encrypted value and leave the encryption to the user.
Off topic: In order to not store secrets in terraform files I use an approach where I store secrets somewhere else, and then use a data provider to get the secret values from there. In that case I only need to reference the value from data source in my TF resources. Secrets are managed manually.
Note for the implementation: how to know if a secret has been changed and need to be updated by terraform ?
The secret API does not offer a way to read the content of a secret (normal) but return the created_at and updated_at date.
Should we store at least the updated_at date in terraform state and when we refresh terraform state (before a plan for instance) we get the secret and compare its update_at date with the one in the state.
A difference in those dates would indicate the secret was updated since the last time terraform interact with. What do you think?
@martinssipenko Thanks!
I think from reading the above comments I'll keep it relatively simple and allow the user of the resource to protect their secrets as they see fit (where possible). I need to see what is available to configure on the API and work on that basis.
EDIT: I'll be making changes here for those interested in tracking progress.
@benj-fletch my only ask on this one is to try to keep things forward compatible with these related enhancements. I'm 👍 on designing for overall Actions support rather than just the secret functionality.
Activity
hronix commentedon Sep 4, 2019
Yes please
zzh8829 commentedon Sep 27, 2019
github hasn't made api for secrets available yet, we have to wait for now
iniinikoski commentedon Dec 19, 2019
Hi. Any updates on this - is the Secrets API still private...?
gjambet commentedon Jan 15, 2020
❤️
jcudit commentedon Jan 16, 2020
GitHub is aiming to make this endpoint available within the next few sprints. Mention me here if I don't post an update in a month or so.
ajliv commentedon Jan 27, 2020
Secrets have been added to the GitHub API https://developer.github.com/v3/actions/secrets/
martinssipenko commentedon Jan 28, 2020
We now need to wait till Go GitHub client releases action secrets - google/go-github#1402
bkamin29 commentedon Feb 3, 2020
+1
btkostner commentedon Feb 10, 2020
It looks like it was merged google/go-github#1402 (comment) and released in the v29.0.3 tag.
martinssipenko commentedon Feb 11, 2020
I think we should also wait for #342 before we start implementing this one.
martinssipenko commentedon Feb 11, 2020
What do we think about usage? Should action secrets be a new resource -
github_repository_action_secretand be used as follows?hazcod commentedon Feb 11, 2020
Is there a way to provide ciphertexts in terraform and supply the key via an environment variable?
I can imagine it's problematic to store plaintext github secrets in terraform files ... which might be located on github again.
martinssipenko commentedon Feb 11, 2020
@hazcod I think one option would be that resource accepts two conflicting arguments -
secretandencrypted_secret, Thesecretcould be used to pass plain text value which would be encrypted by terraform using GitHubs public key. Theencrypted_secretwould accept already encrypted value and leave the encryption to the user.Off topic: In order to not store secrets in terraform files I use an approach where I store secrets somewhere else, and then use a data provider to get the secret values from there. In that case I only need to reference the value from data source in my TF resources. Secrets are managed manually.
martinssipenko commentedon Feb 11, 2020
@radeksimko @jcudit @paultyng what are your thoughts on this?
tgermain commentedon Feb 11, 2020
Note for the implementation: how to know if a secret has been changed and need to be updated by terraform ?
The secret API does not offer a way to read the content of a secret (normal) but return the
created_atandupdated_atdate.Should we store at least the
updated_atdate in terraform state and when we refresh terraform state (before a plan for instance) we get the secret and compare itsupdate_atdate with the one in the state.A difference in those dates would indicate the secret was updated since the last time terraform interact with. What do you think?
9 remaining items
benj-fletch commentedon Feb 18, 2020
Hi, I'd like to take on this as we have a requirement for it in our organisation.
I think that we'd need to merge in https://github.com/terraform-providers/terraform-provider-github/pull/342 before work can be undertaken here, however, since v29 of
go-githubcontains the calls we would need to utilise.If it's ok, I'll start work on this in a branch of master merged with https://github.com/terraform-providers/terraform-provider-github/pull/342 and we can go from there?
martinssipenko commentedon Feb 18, 2020
@benj-fletch if you need any help, feel free to ask me.
benj-fletch commentedon Feb 18, 2020
@martinssipenko Thanks!
I think from reading the above comments I'll keep it relatively simple and allow the user of the resource to protect their secrets as they see fit (where possible). I need to see what is available to configure on the API and work on that basis.
EDIT: I'll be making changes here for those interested in tracking progress.
jcudit commentedon Feb 18, 2020
@benj-fletch my only ask on this one is to try to keep things forward compatible with these related enhancements. I'm 👍 on designing for overall Actions support rather than just the
secretfunctionality.benj-fletch commentedon Feb 18, 2020
@jcudit Sure thing, I will try my best to do so!
techjacker commentedon Mar 16, 2020
Any idea when this will get merged? Would be very handy feature
Merge pull request #369 from dmwgroup/gh-271-update-to-go-github-v29-0-3
Merge pull request #362 from dmwgroup/gh-271-github-secrets
benj-fletch commentedon Apr 1, 2020
I believe that this ticket can be closed now, following the merge of #362 ?
integrationsGH-271 - Applying patches to test
Merge branch 'master' into integrationsgh-271-update-to-go-github-v29…
Merge pull request integrations#369 from dmwgroup/integrationsgh-271-…
Update to go-github v29.0.3
Merge pull request integrations#362 from dmwgroup/integrationsgh-271-…