Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add GCS source support for modules #21254

Merged
merged 2 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configs/configload/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
var goGetterDetectors = []getter.Detector{
new(getter.GitHubDetector),
new(getter.BitBucketDetector),
new(getter.GCSDetector),
new(getter.S3Detector),
new(getter.FileDetector),
}
Expand All @@ -44,6 +45,7 @@ var goGetterDecompressors = map[string]getter.Decompressor{

var goGetterGetters = map[string]getter.Getter{
"file": new(getter.FileGetter),
"gcs": new(getter.GCSGetter),
"git": new(getter.GitGetter),
"hg": new(getter.HgGetter),
"s3": new(getter.S3Getter),
Expand Down
2 changes: 2 additions & 0 deletions internal/initwd/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
var goGetterDetectors = []getter.Detector{
new(getter.GitHubDetector),
new(getter.BitBucketDetector),
new(getter.GCSDetector),
new(getter.S3Detector),
new(getter.FileDetector),
}
Expand All @@ -46,6 +47,7 @@ var goGetterDecompressors = map[string]getter.Decompressor{

var goGetterGetters = map[string]getter.Getter{
"file": new(getter.FileGetter),
"gcs": new(getter.GCSGetter),
"git": new(getter.GitGetter),
"hg": new(getter.HgGetter),
"s3": new(getter.S3Getter),
Expand Down
26 changes: 26 additions & 0 deletions website/docs/modules/sources.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ types, as listed below.

* [S3 buckets](#s3-bucket)

* [GCS buckets](#gcs-bucket)

Each of these is described in the following sections. Module source addresses
use a _URL-like_ syntax, but with extensions to support unambiguous selection
of sources and additional features.
Expand Down Expand Up @@ -375,6 +377,30 @@ preferring those earlier in the list when multiple are available:
* If running on an EC2 instance, temporary credentials associated with the
instance's IAM Instance Profile.

## GCS Bucket

You can use archives stored in Google Cloud Storage as module sources using the special `gcs::`
prefix, followed by
[a GCS bucket object URL](https://cloud.google.com/storage/docs/request-endpoints#typical).

For example

* `gcs::https://www.googleapis.com/storage/v1/BUCKET_NAME/PATH_TO_MODULE`
* `gcs::https://www.googleapis.com/storage/v1/BUCKET_NAME/PATH/TO/module.zip`

```hcl
module "consul" {
source = "gcs::https://www.googleapis.com/storage/v1/modules/foomodule.zip"
}
```

The module installer uses Google Cloud SDK to authenticate with GCS. To set credentials you can:

* Enter the path of your service account key file in the GOOGLE_APPLICATION_CREDENTIALS environment variable, or;
* If you're running Terraform from a GCE instance, default credentials are automatically available. See [Creating and Enabling Service Accounts](https://cloud.google.com/compute/docs/authentication) for Instances for more details
* On your computer, you can make your Google identity available by running `gcloud auth application-default login`.


## Modules in Package Sub-directories

When the source of a module is a version control repository or archive file
Expand Down