docs: Ambiguous "datasource is used to get a reference to the repository"
mloskot opened this issue · comments
The current https://registry.terraform.io/providers/fluxcd/flux/latest/docs/guides/github says:
but there is no use of the actual github_repository or any other data source in the guide.
The guide only refers to (one) GitHub provider resource:
terraform-provider-flux/docs/guides/github.md
Lines 75 to 77 in fa794b3
IMO, the sentence referenced at the beginning of this issue above is confusing.
BTW, this issue seems to also apply to the GitLab guide
I guess, the datasource reference may come from some old version of the examples, like in here
terraform-provider-flux/examples/multi-env/main.tf
Lines 17 to 19 in fa794b3
@mloskot the example is valid as the github_repository_deploy_key
and gitlab_deploy_key
are deploy keys added to the Github or Gitlab repositories.
Without these, flux would not be able to connect to the repositories in question within the provider configuration (see below):
provider "flux" {
git = {
url = "ssh://git@gitlab.com/${data.gitlab_project.this.path_with_namespace}.git"
ssh = {
username = "git"
private_key = tls_private_key.flux.private_key_pem
}
}
}
The private_key
value above is the same private key used as the deploy key for the repository.
Please let me know if this makes sense, if it does I will create a PR to add some comments to the terraform code.
the example is valid (...)
I did not suggest the example is not valid.
I only complained about the description accompanying the example as being confusing:
The GitHub repository is created separatly so a datasource is used
to get a reference to the repository.
and the example does not make use of any data source, what I explained in my report above.
Although I did grasp the idea behind use of the keys and the overall workflow, thank you very much for the further explanation.
@mloskot I am glad we managed to resolve your issue, are you happy that we close this issue?