-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.tf
More file actions
93 lines (76 loc) · 1.91 KB
/
main.tf
File metadata and controls
93 lines (76 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# This is a very simple example to deploy a few cheap resources into AWS to test the new `terraform plan` and `terraform apply` subcommands.
terraform {
required_version = ">= 1.5.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.56"
}
google = {
source = "hashicorp/google"
version = ">= 4.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.0"
}
}
}
provider "aws" {}
provider "aws" {
alias = "aliased"
region = "us-east-1"
}
provider "google" {
project = "overmind-demo"
region = "us-central1"
}
provider "google" {
alias = "west"
project = "overmind-demo-west"
region = "us-west1"
zone = "us-west1-a"
}
provider "google" {
alias = "dogfood"
project = "ovm-dogfood"
region = "europe-west2"
zone = "europe-west2-a"
}
variable "bucket_postfix" {
type = string
description = "The prefix to apply to the bucket name."
default = "test"
}
module "bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "~> 4.0"
bucket_prefix = "cli-test${var.bucket_postfix}"
control_object_ownership = true
object_ownership = "BucketOwnerEnforced"
block_public_policy = true
block_public_acls = true
ignore_public_acls = true
restrict_public_buckets = true
}
# Simple GCP storage buckets for testing multiple providers
resource "google_storage_bucket" "test" {
name = "cli-test-${var.bucket_postfix}-${random_id.bucket_suffix.hex}"
location = "US"
uniform_bucket_level_access = true
versioning {
enabled = true
}
}
resource "google_storage_bucket" "test_west" {
provider = google.west
name = "cli-test-west-${var.bucket_postfix}-${random_id.bucket_suffix.hex}"
location = "US-WEST1"
uniform_bucket_level_access = true
versioning {
enabled = true
}
}
resource "random_id" "bucket_suffix" {
byte_length = 8
}