I am looking for options to specify the reusable aws modules which are stored in a separate project in gitlab. For example, if there is a generic ec2 component I will call that in my module and pass any specific variables etc.,
module "terraform_tags" {
source = "git::https://gitlab.my.company.com/aws-ec2.git"
}
The approach works if i explicitly add username and token in the source:
i.e., source = "git::https://username:<tokenvalue>@gitlab.my.company.com/aws-ec2.git"
But I would like to have the code for this module written in such a way that token value is passed as a variable instead of being explicitly mentioned in the code itself. If I try to add it as a gitlab variable it gives an error saying ‘value must be known’.
Any ideas on how this can be achieved?