Skip to content

Feature request: Support secret creation for github actions #271

Closed

Description

@gjambet

Hi friends,

it would be super cool to be able to set secrets for actions through terraform while creating a repository. ;)

ty,

g. (happy action user)

Activity

  1. hronix commented on Sep 4, 2019

    @hronix

    Yes please

  2. zzh8829 commented on Sep 27, 2019

    @zzh8829

    github hasn't made api for secrets available yet, we have to wait for now

  3. iniinikoski commented on Dec 19, 2019

    @iniinikoski

    Hi. Any updates on this - is the Secrets API still private...?

  4. gjambet commented on Jan 15, 2020

    @gjambet
    Author

    ❤️

  5. jcudit commented on Jan 16, 2020

    @jcudit
    Contributor

    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.

  6. ajliv commented on Jan 27, 2020

    @ajliv
  7. martinssipenko commented on Jan 28, 2020

    @martinssipenko
    Contributor

    We now need to wait till Go GitHub client releases action secrets - google/go-github#1402

  8. bkamin29 commented on Feb 3, 2020

    @bkamin29

    +1

  9. btkostner commented on Feb 10, 2020

    @btkostner
    Contributor

    It looks like it was merged google/go-github#1402 (comment) and released in the v29.0.3 tag.

  10. martinssipenko commented on Feb 11, 2020

    @martinssipenko
    Contributor

    I think we should also wait for #342 before we start implementing this one.

  11. martinssipenko commented on Feb 11, 2020

    @martinssipenko
    Contributor

    What do we think about usage? Should action secrets be a new resource - github_repository_action_secret and be used as follows?

    resource "github_repository_action_secret" "foo" {
        repository = "${github_repository.repo.name}"
        name       = "FOO"
        secret     = "plain secret"
    }
  12. hazcod commented on Feb 11, 2020

    @hazcod

    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.

  13. martinssipenko commented on Feb 11, 2020

    @martinssipenko
    Contributor

    @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.

  14. martinssipenko commented on Feb 11, 2020

    @martinssipenko
    Contributor

    @radeksimko @jcudit @paultyng what are your thoughts on this?

  15. tgermain commented on Feb 11, 2020

    @tgermain
    Contributor

    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?

  16. 9 remaining items

  17. benj-fletch commented on Feb 18, 2020

    @benj-fletch
    Contributor

    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-github contains 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?

  18. martinssipenko commented on Feb 18, 2020

    @martinssipenko
    Contributor

    @benj-fletch if you need any help, feel free to ask me.

  19. benj-fletch commented on Feb 18, 2020

    @benj-fletch
    Contributor

    @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.

  20. jcudit commented on Feb 18, 2020

    @jcudit
    Contributor

    @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.

  21. benj-fletch commented on Feb 18, 2020

    @benj-fletch
    Contributor

    @jcudit Sure thing, I will try my best to do so!

  22. techjacker commented on Mar 16, 2020

    @techjacker

    Any idea when this will get merged? Would be very handy feature

  23. added 2 commits that reference this issue on Mar 20, 2020
  24. benj-fletch commented on Apr 1, 2020

    @benj-fletch
    Contributor

    I believe that this ticket can be closed now, following the merge of #362 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    New resourceStatus: Up for grabsType: Featuresize/Mthinking

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions