Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: add use case for obj storage demo #70

Merged
merged 1 commit into from
Jun 28, 2022
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
18 changes: 1 addition & 17 deletions tests/resources/virtual_machine/virtual_machine/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "cloud" {
type = string
default = "aws"
default = "azure"
}

variable "location" {
Expand All @@ -26,22 +26,6 @@ resource "multy_network_security_group" nsg {
virtual_network_id = multy_virtual_network.vn.id
cloud = var.cloud
location = var.location
rule {
protocol = "tcp"
priority = 120
from_port = 22
to_port = 22
cidr_block = "0.0.0.0/0"
direction = "both"
}
rule {
protocol = "tcp"
priority = 131
from_port = 443
to_port = 443
cidr_block = "0.0.0.0/0"
direction = "both"
}
rule {
protocol = "tcp"
priority = 132
Expand Down
58 changes: 58 additions & 0 deletions tests/use_case/object_storage/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
terraform {
required_providers {
multy = {
source = "multycloud/multy"
}
}
}

provider "multy" {
api_key = "XXX-YYY-ZZZ"
aws = {}
azure = {}
server_endpoint = "localhost:8000"
}

variable "clouds" {
type = set(string)
default = ["aws", "azure"]
}

resource "random_string" "obj_suffix" {
length = 4
special = false
upper = false
}

resource "multy_object_storage" "obj_storage" {
for_each = var.clouds
name = "multy-test-${random_string.obj_suffix.result}"
cloud = each.key
location = "us_east_1"
versioning = true
}

resource "multy_object_storage_object" "public_obj_storage" {
for_each = var.clouds
name = "hello_world"
object_storage_id = multy_object_storage.obj_storage[each.key].id
content_base64 = base64encode("<h1>hello world from ${each.key}</h1>")
content_type = "text/html"
acl = "public_read"
}

resource "multy_object_storage_object" "private_obj_storage" {
for_each = var.clouds
name = "super-secret-file"
object_storage_id = multy_object_storage.obj_storage[each.key].id
content_base64 = base64encode("<h1>goodbye world from ${each.key}</h1>")
content_type = "text/html"
}

output "aws_object_url" {
value = multy_object_storage_object.public_obj_storage["aws"].url
}

output "azure_object_url" {
value = multy_object_storage_object.public_obj_storage["azure"].url
}
2 changes: 1 addition & 1 deletion tests/use_case/web_app/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variable "clouds" {

variable "vm_clouds" {
type = set(string)
default = ["aws", "azure"]
default = ["azure"]
}

variable "db_cloud" {
Expand Down