-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.go
41 lines (37 loc) · 1.23 KB
/
storage.go
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
package main
import (
"fmt"
"github.com/pulumi/pulumi-azure-native-sdk/storage/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func (pr *projectResources) newStorageAccount() (err error) {
storageAccountArgs := storage.StorageAccountArgs{
ResourceGroupName: pr.webResourceGrp.Name,
Sku: &storage.SkuArgs{
Name: pulumi.String("Standard_ZRS"),
},
Kind: pulumi.String("StorageV2"),
}
name := pr.cfgKeys.siteKey + pr.cfgKeys.envKey
pr.webStorageAccount, err = storage.NewStorageAccount(pr.pulumiCtx, name, &storageAccountArgs)
if err != nil {
fmt.Printf("ERROR: creating storageAccount %s failed\n", name)
return err
}
return
}
func (pr *projectResources) enableStaticWebHostOnStorageAccount() (err error) {
// Enable static website support for the Storage Account
storageArgs := storage.StorageAccountStaticWebsiteArgs{
AccountName: pr.webStorageAccount.Name,
ResourceGroupName: pr.webResourceGrp.Name,
IndexDocument: pulumi.String("index.html"),
Error404Document: pulumi.String("404.hml"),
}
_, err = storage.NewStorageAccountStaticWebsite(pr.pulumiCtx, pr.cfgKeys.siteKey, &storageArgs)
if err != nil {
fmt.Printf("ERROR: creating staticWebsite %s failed\n", pr.cfgKeys.siteKey)
return err
}
return
}