Skip to content

Some Terraform modules that follow Oak naming etc standards

License

Notifications You must be signed in to change notification settings

oaknational/oak-terraform-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oak Terraform Modules

Modules

Developing with modules

Developing a module is slightly trickier than just writing straight Terraform. Here are some tips to help you ease the process.

Keeping it local

When writing a module you will need some code to call that module and test if it works. Far and away the easiest way to do this is create a subdirectory for your module, put all your module config in there, call it from the main Terraform config and finally copy all that config to this repo when it is working.

module "example" {
  source = "./module"

  ...
}

Double dots

If the workspace is processed locally i.e. not in Terraform Cloud, you can have this repo checked out locally and link to it within the module using a relative or full path.

Note. This will not work if the workspace is processed in Terraform Cloud as TFC cannot resolve the path.

module "example" {
  source = "../../oak-terraform-modules/modules/example"

  ...
}

Pointing to a different branch

It is possible to work from this repo, although this is a slower process.

  1. Point the module to your new branch
  2. Push your changes to Github
  3. Update Terraform terraform init -upgrade
  4. Repeat from 2. until it works

Note. If the branch name has a / in it you need to replace that with the URL encoded equivalent: %2F

module "example" {
  source = "github.com/oaknational/oak-terraform-modules//modules/example?ref=feat%2Fexample"

  ...
}

About

Some Terraform modules that follow Oak naming etc standards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages