terraspace_plugin_azurerm 0.5.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/templates/hcl/project/config/terraform/backend.tf +7 -3
- data/lib/templates/ruby/project/config/terraform/backend.rb +7 -3
- data/lib/terraspace_plugin_azurerm/interfaces/ci.rb +13 -0
- data/lib/terraspace_plugin_azurerm/interfaces/expander.rb +16 -0
- data/lib/terraspace_plugin_azurerm/version.rb +1 -1
- data/lib/terraspace_plugin_azurerm.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7da72538ffbee61c239cf97e32efb769f95372d3d27f080c57322581809129ae
|
4
|
+
data.tar.gz: 2fa26926d7f09800251898bf37b7860239771c622b43a2ee2f370f993f20f2bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96c0b8de52a7532a7410eab1ca4ede56c9dc87efe4dbbf8f29e2f77e545b1a39542e8e92d7b88504354fc2bde7dd60e04271f6fc87c8c152b6caa3bdda2bc169
|
7
|
+
data.tar.gz: e1e533ac953828f31b399f0f56df35b34eb3678442a8ab76eac936c33137592805773e6d06b745d5e38da93c04e8348b7a48885bb2750e503c5e8cdad43b0579
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [0.6.2] - 2022-07-13
|
7
|
+
- [#18](https://github.com/boltops-tools/terraspace_plugin_azurerm/pull/18) add backend config variables docs comment
|
8
|
+
|
9
|
+
## [0.6.1] - 2022-06-14
|
10
|
+
- [#17](https://github.com/boltops-tools/terraspace_plugin_azurerm/pull/17) backend.tf template project variable
|
11
|
+
|
12
|
+
## [0.6.0] - 2022-06-10
|
13
|
+
- [#16](https://github.com/boltops-tools/terraspace_plugin_azurerm/pull/16) update generated backend key and ci interface
|
14
|
+
|
6
15
|
## [0.5.1] - 2022-05-03
|
7
16
|
- [#15](https://github.com/boltops-tools/terraspace_plugin_azurerm/pull/15) pascalCase
|
8
17
|
|
@@ -1,10 +1,14 @@
|
|
1
|
+
# Backend Config Variables Docs
|
2
|
+
# https://terraspace.cloud/docs/config/backend/variables/
|
3
|
+
#
|
1
4
|
# SUBSCRIPTION_HASH is a short 4-char consistent hash of the longer subscription id.
|
5
|
+
# LOCATION_HASH is a short 4-char consistent hash of the longer location.
|
2
6
|
# This is useful because azure storage account names are not allowed special characters and are limited to 24 chars.
|
3
7
|
terraform {
|
4
8
|
backend "azurerm" {
|
5
|
-
resource_group_name = "<%= expansion(':ENV-:LOCATION') %>"
|
6
|
-
storage_account_name = "<%= expansion('ts:SUBSCRIPTION_HASH:
|
9
|
+
resource_group_name = "<%= expansion(':APP-:ENV-:LOCATION') %>"
|
10
|
+
storage_account_name = "<%= expansion('ts:APP_HASH:SUBSCRIPTION_HASH:LOCATION_HASH:ENV') %>"
|
7
11
|
container_name = "terraform-state"
|
8
|
-
key = "<%= expansion(':
|
12
|
+
key = "<%= expansion(':PROJECT/:TYPE_DIR/:APP/:ROLE/:MOD_NAME/:ENV/:EXTRA/:LOCATION/terraform.tfstate') %>"
|
9
13
|
}
|
10
14
|
}
|
@@ -1,8 +1,12 @@
|
|
1
|
+
# Backend Config Variables Docs
|
2
|
+
# https://terraspace.cloud/docs/config/backend/variables/
|
3
|
+
#
|
1
4
|
# SUBSCRIPTION_HASH is a short 4-char consistent hash of the longer subscription id.
|
5
|
+
# LOCATION_HASH is a short 4-char consistent hash of the longer location.
|
2
6
|
# This is useful because azure storage account names are not allowed special characters and are limited to 24 chars.
|
3
7
|
backend("azurerm",
|
4
|
-
resource_group_name: "
|
5
|
-
storage_account_name: "ts:SUBSCRIPTION_HASH:
|
8
|
+
resource_group_name: ":APP-:ENV-:LOCATION",
|
9
|
+
storage_account_name: "ts:APP_HASH:SUBSCRIPTION_HASH:LOCATION_HASH:ENV",
|
6
10
|
container_name: "terraform-state",
|
7
|
-
key: ":
|
11
|
+
key: ":PROJECT/:TYPE_DIR/:APP/:ROLE/:MOD_NAME/:ENV/:EXTRA/:LOCATION/terraform.tfstate",
|
8
12
|
)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module TerraspacePluginAzurerm::Interfaces
|
2
|
+
class Ci
|
3
|
+
# interface method
|
4
|
+
def vars
|
5
|
+
{
|
6
|
+
ARM_SUBSCRIPTION_ID: '${{ secrets.ARM_SUBSCRIPTION_ID }}',
|
7
|
+
ARM_CLIENT_SECRET: '${{ secrets.ARM_CLIENT_SECRET }}',
|
8
|
+
ARM_TENANT_ID: '${{ secrets.ARM_TENANT_ID }}',
|
9
|
+
ARM_CLIENT_ID: '${{ secrets.ARM_CLIENT_ID }}',
|
10
|
+
}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -29,5 +29,21 @@ module TerraspacePluginAzurerm::Interfaces
|
|
29
29
|
Digest::SHA1.hexdigest(subscription)[0..3]
|
30
30
|
end
|
31
31
|
alias_method :namespace_hash, :subscription_hash
|
32
|
+
|
33
|
+
# location_hash is a short 4-char consistent hash of the longer subscription id.
|
34
|
+
# This is useful because azure storage account names are not allowed special characters and are limited to 24 chars.
|
35
|
+
# NOTE: be careful to not change this! or else state path will change
|
36
|
+
def location_hash
|
37
|
+
Digest::SHA1.hexdigest(location)[0..3]
|
38
|
+
end
|
39
|
+
alias_method :region_hash, :location_hash
|
40
|
+
|
41
|
+
def app_hash
|
42
|
+
Digest::SHA1.hexdigest(ENV['TS_APP'])[0..3] if ENV['TS_APP']
|
43
|
+
end
|
44
|
+
|
45
|
+
def env_hash
|
46
|
+
Digest::SHA1.hexdigest(ENV['TS_ENV'])[0..3] if ENV['TS_ENV']
|
47
|
+
end
|
32
48
|
end
|
33
49
|
end
|
@@ -41,5 +41,6 @@ Terraspace::Plugin.register("azurerm",
|
|
41
41
|
config_class: TerraspacePluginAzurerm::Interfaces::Config,
|
42
42
|
helper_class: TerraspacePluginAzurerm::Interfaces::Helper,
|
43
43
|
layer_class: TerraspacePluginAzurerm::Interfaces::Layer,
|
44
|
+
ci_class: TerraspacePluginAzurerm::Interfaces::Ci,
|
44
45
|
root: File.dirname(__dir__),
|
45
46
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraspace_plugin_azurerm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: armrest
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/terraspace_plugin_azurerm/interfaces/backend/blob_container.rb
|
119
119
|
- lib/terraspace_plugin_azurerm/interfaces/backend/resource_group_creator.rb
|
120
120
|
- lib/terraspace_plugin_azurerm/interfaces/backend/storage_account.rb
|
121
|
+
- lib/terraspace_plugin_azurerm/interfaces/ci.rb
|
121
122
|
- lib/terraspace_plugin_azurerm/interfaces/config.rb
|
122
123
|
- lib/terraspace_plugin_azurerm/interfaces/expander.rb
|
123
124
|
- lib/terraspace_plugin_azurerm/interfaces/helper.rb
|