From aec45e696701b4aa09958b5e683831b293d6a85e Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 6 Dec 2017 16:47:29 -0500 Subject: [PATCH] backends should never create unmanaged resources The backend was creating bucket named in the configuration if it didn't exist. We don't allow other backends to do this, because these are not managed resources that terraform can control. --- backend/remote-state/gcs/backend.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/backend/remote-state/gcs/backend.go b/backend/remote-state/gcs/backend.go index a08f4e0cb..1491a9b6d 100644 --- a/backend/remote-state/gcs/backend.go +++ b/backend/remote-state/gcs/backend.go @@ -128,22 +128,5 @@ func (b *gcsBackend) configure(ctx context.Context) error { b.storageClient = client - return b.ensureBucketExists() -} - -func (b *gcsBackend) ensureBucketExists() error { - _, err := b.storageClient.Bucket(b.bucketName).Attrs(b.storageContext) - if err != storage.ErrBucketNotExist { - return err - } - - if b.projectID == "" { - return fmt.Errorf("bucket %q does not exist; specify the \"project\" option or create the bucket manually using `gsutil mb gs://%s`", b.bucketName, b.bucketName) - } - - attrs := &storage.BucketAttrs{ - Location: b.region, - } - - return b.storageClient.Bucket(b.bucketName).Create(b.storageContext, b.projectID, attrs) + return nil }