azure-blob 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/main.tf ADDED
@@ -0,0 +1,187 @@
1
+ terraform {
2
+ required_providers {
3
+ azurerm = {
4
+ source = "hashicorp/azurerm"
5
+ version = "~>3.0"
6
+ }
7
+ }
8
+ }
9
+
10
+ provider "azurerm" {
11
+ features {}
12
+ }
13
+
14
+ locals {
15
+ public_ssh_key = var.ssh_key != "" ? var.ssh_key : file("~/.ssh/id_rsa.pub")
16
+ }
17
+
18
+ resource "azurerm_resource_group" "main" {
19
+ name = var.prefix
20
+ location = var.location
21
+ tags = {
22
+ source = "Terraform"
23
+ }
24
+ }
25
+
26
+ resource "azurerm_storage_account" "main" {
27
+ name = var.storage_account_name
28
+ resource_group_name = azurerm_resource_group.main.name
29
+ location = azurerm_resource_group.main.location
30
+ account_tier = "Standard"
31
+ account_replication_type = "LRS"
32
+
33
+ tags = {
34
+ source = "Terraform"
35
+ }
36
+ }
37
+
38
+ resource "azurerm_storage_container" "private" {
39
+ name = "private"
40
+ storage_account_name = azurerm_storage_account.main.name
41
+ container_access_type = "private"
42
+ }
43
+
44
+ resource "azurerm_storage_container" "public" {
45
+ name = "public"
46
+ storage_account_name = azurerm_storage_account.main.name
47
+ container_access_type = "blob"
48
+ }
49
+
50
+ resource "azurerm_virtual_network" "main" {
51
+ count = var.create_vm ? 1 : 0
52
+ name = "${var.prefix}-network"
53
+ address_space = ["10.0.0.0/16"]
54
+ location = azurerm_resource_group.main.location
55
+ resource_group_name = azurerm_resource_group.main.name
56
+
57
+ tags = {
58
+ source = "Terraform"
59
+ }
60
+ }
61
+
62
+ resource "azurerm_subnet" "main" {
63
+ count = var.create_vm ? 1 : 0
64
+ name = "${var.prefix}-main"
65
+ resource_group_name = azurerm_resource_group.main.name
66
+ virtual_network_name = azurerm_virtual_network.main[0].name
67
+ address_prefixes = ["10.0.2.0/24"]
68
+ }
69
+
70
+ resource "azurerm_network_interface" "main" {
71
+ count = var.create_vm ? 1 : 0
72
+ name = "${var.prefix}-nic"
73
+ location = azurerm_resource_group.main.location
74
+ resource_group_name = azurerm_resource_group.main.name
75
+
76
+ ip_configuration {
77
+ name = "${var.prefix}-ip-config"
78
+ subnet_id = azurerm_subnet.main[0].id
79
+ private_ip_address_allocation = "Dynamic"
80
+ public_ip_address_id = azurerm_public_ip.main[0].id
81
+ }
82
+
83
+ tags = {
84
+ source = "Terraform"
85
+ }
86
+ }
87
+
88
+ resource "azurerm_public_ip" "main" {
89
+ count = var.create_vm ? 1 : 0
90
+ name = "${var.prefix}-public-ip"
91
+ resource_group_name = azurerm_resource_group.main.name
92
+ location = azurerm_resource_group.main.location
93
+ allocation_method = "Static"
94
+
95
+ tags = {
96
+ source = "Terraform"
97
+ }
98
+ }
99
+
100
+ resource "azurerm_user_assigned_identity" "vm" {
101
+ location = azurerm_resource_group.main.location
102
+ name = "${var.prefix}-vm"
103
+ resource_group_name = azurerm_resource_group.main.name
104
+ }
105
+
106
+
107
+ resource "azurerm_role_assignment" "vm" {
108
+ scope = azurerm_storage_account.main.id
109
+ role_definition_name = "Storage Blob Data Contributor"
110
+ principal_id = azurerm_user_assigned_identity.vm.principal_id
111
+ }
112
+
113
+ resource "azurerm_linux_virtual_machine" "main" {
114
+ count = var.create_vm ? 1 : 0
115
+ name = "${var.prefix}-vm"
116
+ computer_name = var.prefix
117
+ resource_group_name = azurerm_resource_group.main.name
118
+ location = azurerm_resource_group.main.location
119
+ size = var.vm_size
120
+ admin_username = var.vm_username
121
+ admin_password = var.vm_password
122
+ disable_password_authentication = true
123
+ network_interface_ids = [azurerm_network_interface.main[0].id]
124
+
125
+ identity {
126
+ type = "UserAssigned"
127
+ identity_ids = [azurerm_user_assigned_identity.vm.id]
128
+ }
129
+
130
+ admin_ssh_key {
131
+ username = var.vm_username
132
+ public_key = local.public_ssh_key
133
+ }
134
+
135
+ source_image_reference {
136
+ publisher = "Canonical"
137
+ offer = "0001-com-ubuntu-server-jammy"
138
+ sku = "22_04-lts"
139
+ version = "latest"
140
+ }
141
+
142
+ os_disk {
143
+ caching = "ReadWrite"
144
+ storage_account_type = "Standard_LRS"
145
+ }
146
+
147
+ tags = {
148
+ source = "Terraform"
149
+ }
150
+ }
151
+
152
+ resource "azurerm_service_plan" "main" {
153
+ count = var.create_app_service ? 1 : 0
154
+ name = "${var.prefix}-appserviceplan"
155
+ resource_group_name = azurerm_resource_group.main.name
156
+ location = azurerm_resource_group.main.location
157
+ os_type = "Linux"
158
+ sku_name = "B1"
159
+ }
160
+
161
+ resource "azurerm_linux_web_app" "main" {
162
+ count = var.create_app_service ? 1 : 0
163
+ name = "${var.prefix}-app"
164
+ service_plan_id = azurerm_service_plan.main[0].id
165
+ resource_group_name = azurerm_resource_group.main.name
166
+ location = azurerm_resource_group.main.location
167
+
168
+ identity {
169
+ type = "UserAssigned"
170
+ identity_ids = [azurerm_user_assigned_identity.vm.id]
171
+ }
172
+
173
+ site_config {
174
+ application_stack {
175
+ node_version = "20-lts"
176
+ }
177
+ }
178
+ }
179
+
180
+ resource "azurerm_app_service_source_control" "main" {
181
+ count = var.create_app_service ? 1 : 0
182
+ app_id = azurerm_linux_web_app.main[0].id
183
+ repo_url = "https://github.com/Azure-Samples/nodejs-docs-hello-world"
184
+ branch = "master"
185
+ use_manual_integration = true
186
+ use_mercurial = false
187
+ }
data/output.tf ADDED
@@ -0,0 +1,30 @@
1
+ output "devenv_local_nix" {
2
+ sensitive = true
3
+ value = <<EOT
4
+ {pkgs, lib, ...}:{
5
+ env = {
6
+ AZURE_ACCOUNT_NAME = "${azurerm_storage_account.main.name}";
7
+ AZURE_ACCESS_KEY = "${azurerm_storage_account.main.primary_access_key}";
8
+ AZURE_PRIVATE_CONTAINER = "${azurerm_storage_container.private.name}";
9
+ AZURE_PUBLIC_CONTAINER = "${azurerm_storage_container.public.name}";
10
+ AZURE_PRINCIPAL_ID = "${azurerm_user_assigned_identity.vm.principal_id}";
11
+ };
12
+ }
13
+ EOT
14
+ }
15
+
16
+ output "vm_ip" {
17
+ value = var.create_vm ? azurerm_public_ip.main[0].ip_address : ""
18
+ }
19
+
20
+ output "vm_username" {
21
+ value = var.vm_username
22
+ }
23
+
24
+ output "app_service_app_name" {
25
+ value = var.create_app_service ? azurerm_linux_web_app.main[0].name : ""
26
+ }
27
+
28
+ output "resource_group" {
29
+ value = azurerm_resource_group.main.name
30
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure-blob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joé Dupuis
@@ -34,6 +34,7 @@ files:
34
34
  - ".envrc"
35
35
  - ".rubocop.yml"
36
36
  - ".standard.yml"
37
+ - ".terraform.lock.hcl"
37
38
  - CHANGELOG.md
38
39
  - LICENSE.txt
39
40
  - README.md
@@ -43,6 +44,7 @@ files:
43
44
  - devenv.lock
44
45
  - devenv.nix
45
46
  - devenv.yaml
47
+ - input.tf
46
48
  - lib/active_storage/service/azure_blob_service.rb
47
49
  - lib/azure_blob.rb
48
50
  - lib/azure_blob/blob.rb
@@ -52,18 +54,24 @@ files:
52
54
  - lib/azure_blob/canonicalized_resource.rb
53
55
  - lib/azure_blob/client.rb
54
56
  - lib/azure_blob/const.rb
57
+ - lib/azure_blob/entra_id_signer.rb
55
58
  - lib/azure_blob/errors.rb
56
59
  - lib/azure_blob/http.rb
60
+ - lib/azure_blob/identity_token.rb
57
61
  - lib/azure_blob/metadata.rb
58
- - lib/azure_blob/signer.rb
62
+ - lib/azure_blob/shared_key_signer.rb
63
+ - lib/azure_blob/user_delegation_key.rb
59
64
  - lib/azure_blob/version.rb
60
- homepage: https://github.com/JoeDupuis/azure-blob
65
+ - main.tf
66
+ - output.tf
67
+ homepage: https://github.com/testdouble/azure-blob
61
68
  licenses:
62
69
  - MIT
63
70
  metadata:
64
- homepage_uri: https://github.com/JoeDupuis/azure-blob
65
- source_code_uri: https://github.com/JoeDupuis/azure-blob
66
- changelog_uri: https://github.com/JoeDupuis/azure-blob/blob/main/CHANGELOG.md
71
+ rubygems_mfa_required: 'true'
72
+ homepage_uri: https://github.com/testdouble/azure-blob
73
+ source_code_uri: https://github.com/testdouble/azure-blob
74
+ changelog_uri: https://github.com/testdouble/azure-blob/blob/main/CHANGELOG.md
67
75
  post_install_message:
68
76
  rdoc_options: []
69
77
  require_paths: