Skip to content

Commit 59c5cc4

Browse files
author
Pam Selle
authored
Merge pull request #21254 from davewongillies/gcs
Add GCS source support for modules
2 parents edd005c + af6083e commit 59c5cc4

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

configs/configload/getter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
var goGetterDetectors = []getter.Detector{
2121
new(getter.GitHubDetector),
2222
new(getter.BitBucketDetector),
23+
new(getter.GCSDetector),
2324
new(getter.S3Detector),
2425
new(getter.FileDetector),
2526
}
@@ -44,6 +45,7 @@ var goGetterDecompressors = map[string]getter.Decompressor{
4445

4546
var goGetterGetters = map[string]getter.Getter{
4647
"file": new(getter.FileGetter),
48+
"gcs": new(getter.GCSGetter),
4749
"git": new(getter.GitGetter),
4850
"hg": new(getter.HgGetter),
4951
"s3": new(getter.S3Getter),

internal/initwd/getter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
var goGetterDetectors = []getter.Detector{
2323
new(getter.GitHubDetector),
2424
new(getter.BitBucketDetector),
25+
new(getter.GCSDetector),
2526
new(getter.S3Detector),
2627
new(getter.FileDetector),
2728
}
@@ -46,6 +47,7 @@ var goGetterDecompressors = map[string]getter.Decompressor{
4647

4748
var goGetterGetters = map[string]getter.Getter{
4849
"file": new(getter.FileGetter),
50+
"gcs": new(getter.GCSGetter),
4951
"git": new(getter.GitGetter),
5052
"hg": new(getter.HgGetter),
5153
"s3": new(getter.S3Getter),

website/docs/modules/sources.html.markdown

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ types, as listed below.
3131

3232
* [S3 buckets](#s3-bucket)
3333

34+
* [GCS buckets](#gcs-bucket)
35+
3436
Each of these is described in the following sections. Module source addresses
3537
use a _URL-like_ syntax, but with extensions to support unambiguous selection
3638
of sources and additional features.
@@ -375,6 +377,30 @@ preferring those earlier in the list when multiple are available:
375377
* If running on an EC2 instance, temporary credentials associated with the
376378
instance's IAM Instance Profile.
377379

380+
## GCS Bucket
381+
382+
You can use archives stored in Google Cloud Storage as module sources using the special `gcs::`
383+
prefix, followed by
384+
[a GCS bucket object URL](https://cloud.google.com/storage/docs/request-endpoints#typical).
385+
386+
For example
387+
388+
* `gcs::https://www.googleapis.com/storage/v1/BUCKET_NAME/PATH_TO_MODULE`
389+
* `gcs::https://www.googleapis.com/storage/v1/BUCKET_NAME/PATH/TO/module.zip`
390+
391+
```hcl
392+
module "consul" {
393+
source = "gcs::https://www.googleapis.com/storage/v1/modules/foomodule.zip"
394+
}
395+
```
396+
397+
The module installer uses Google Cloud SDK to authenticate with GCS. To set credentials you can:
398+
399+
* Enter the path of your service account key file in the GOOGLE_APPLICATION_CREDENTIALS environment variable, or;
400+
* 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
401+
* On your computer, you can make your Google identity available by running `gcloud auth application-default login`.
402+
403+
378404
## Modules in Package Sub-directories
379405

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

0 commit comments

Comments
 (0)