Skip to content

self host terraform modules for internal gitlab instance issue #11743

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

Closed
Conor-Behard333 opened this issue Jan 22, 2024 · 10 comments
Closed

self host terraform modules for internal gitlab instance issue #11743

Conor-Behard333 opened this issue Jan 22, 2024 · 10 comments
Assignees
Labels
docs Area: coder.com/docs

Comments

@Conor-Behard333
Copy link

Hi,
I want to be able to reference terraform modules from my own git repo and push them to coder using the cli.

An issue I have found is that when using the cli it won't successfully push the modules as I'm referencing a self hosted instance of gitlab and it requires a username and access-token. For example a bot username and an access token which can read the modules repo

module "git-clone"{
  source = "git::https://<username>:<access-token>@<git-url>/coder-modules.git//git-clone?ref=main"
}

While this code does work, it requires having the username and access token publicly available (obviously not wanted).
Does the coder cli have a way of adding the username and access token to the source URL, if not, could this be done?

@cdr-bot cdr-bot bot added the feature label Jan 22, 2024
@matifali
Copy link
Member

matifali commented Jan 22, 2024

#9841 is a bit related.

Meanwhile, you can try saving username and access-token as terraform variables with sensitive=true and refer them.

module "git-clone"{
  source = "git::https://var.username:var.access-token@<git-url>/coder-modules.git//git-clone?ref=main"
}

@Conor-Behard333
Copy link
Author

Yeah I tried that, unfortunately terraform doesn't allow variables for source

@matifali
Copy link
Member

Hi @Conor-Behard333 you can use Artifactory to self host modules. We have added some docs here

@matifali
Copy link
Member

Another solution is to mount/create a .gitconfig file at /home/coder/.gitconfig with following content.

[url "https://${PERSONAL_ACCESS_TOKEN}@git.company.com"]
    insteadOf = https://git.company.com

@matifali matifali added docs Area: coder.com/docs waiting-for-info The issue creator is asked to provide more information. labels Jan 26, 2024
@Conor-Behard333
Copy link
Author

Ahh yeah just noticed Artifactory's support for a terraform module registry. Currently waiting for our team to get a new version of jfrog to be able to do this. In the meantime I will try your other purposed solution.

@matifali
Copy link
Member

As we have two working solutions. Please update if you are able to use them. We may close the issue as completed then.

@matifali matifali removed waiting-for-info The issue creator is asked to provide more information. feature labels Jan 27, 2024
@Conor-Behard333
Copy link
Author

happy for you to close this

@matifali
Copy link
Member

@Conor-Behard333 Thanks. Out of curiosity, which option did you go with? Artifactory or a private git clone?

@Conor-Behard333
Copy link
Author

We already have the existing infrastructure to allow for an artifactory registry so went with that

@matifali
Copy link
Member

matifali commented Jan 29, 2024

I am happy that the instructions were clear enough to follow. I am also planning to add Artifactory instructions to add coder modules as a remote repository instead of a local one. That will automatically allow us to get new published versions. (of course, someone needs to bump the version, too.)

@matifali matifali self-assigned this Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Area: coder.com/docs
Projects
None yet
Development

No branches or pull requests

2 participants