Debian Codegraph @

samples/guestbook/azure/main.tf

raw
1 # Copyright 2019 The Go Cloud Development Kit Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 terraform {
16 required_version = "~>0.12"
17 }
18
19 provider "azurerm" {
20 version = "~> 1.27.0"
21 }
22
23 provider "random" {
24 version = "~> 2.1"
25 }
26
27 resource "random_string" "suffix" {
28 special = false
29 upper = false
30 length = 7
31 }
32
33 # Create a resource group
34 resource "azurerm_resource_group" "guestbook" {
35 name = "guestbook${random_string.suffix.result}"
36 location = var.location
37 }
38
39 # Create a Storage Account, container, and two blobs.
40
41 resource "azurerm_storage_account" "guestbook" {
42 name = "guestbook${random_string.suffix.result}"
43 resource_group_name = azurerm_resource_group.guestbook.name
44 location = var.location
45 account_tier = "Standard"
46 account_replication_type = "GRS"
47 }
48
49 resource "azurerm_storage_container" "guestbook" {
50 name = "guestbook${random_string.suffix.result}"
51 resource_group_name = azurerm_resource_group.guestbook.name
52 storage_account_name = azurerm_storage_account.guestbook.name
53 container_access_type = "private"
54 }
55
56 resource "azurerm_storage_blob" "gopher" {
57 name = "azure.png"
58
59 resource_group_name = azurerm_resource_group.guestbook.name
60 storage_account_name = azurerm_storage_account.guestbook.name
61 storage_container_name = azurerm_storage_container.guestbook.name
62
63 type = "block"
64 content_type = "image/png"
65 source = "${path.module}/../blobs/azure.png"
66 }
67
68 resource "azurerm_storage_blob" "motd" {
69 name = "motd"
70
71 resource_group_name = azurerm_resource_group.guestbook.name
72 storage_account_name = azurerm_storage_account.guestbook.name
73 storage_container_name = azurerm_storage_container.guestbook.name
74
75 type = "block"
76 content_type = "text/plain"
77 source = "${path.module}/../blobs/motd.txt"
78 }
79