How to I reference to an external module for terraform?

1.3k Views Asked by At

In terraform, we can use Generic Git Repository to reference to an external source.

module "log_group" {
  source  = "git::https://github.com/terraform-aws-modules/terraform-aws-cloudwatch?ref=v3.0.0"

How do I do it for log group

module "log_group" {
  source  = "terraform-aws-modules/cloudwatch/aws//modules/log-group"
  version = "~> 3.0"

  name              = "my-app"
  retention_in_days = 120
}

i tried with git::https://github.com/terraform-aws-modules/terraform-aws-cloudwatch/modules/log_group?ref=v3.0.0 but it is incorrect.

1

There are 1 best solutions below

0
On

i found the issue.

i should be using // instead of a /

module "log_group" {
  source = "git::https://github.com/terraform-aws-modules/terraform-aws-cloudwatch//modules/log-group?ref=v3.0.0"