terraspace_plugin_azurerm 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/templates/hcl/project/config/terraform/backend.tf +4 -3
- data/lib/templates/ruby/project/config/terraform/backend.rb +4 -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: 164c2f861c27f9b9a6427ea7a0bc710a150f8e6d2b95f71249434849aaa4f6b4
|
4
|
+
data.tar.gz: b1363b09aab88c7453eb1bd88cf0ea9672696e98e33a6ec2ca31fcfb4ecc99a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7561f51bb0b4fa310bb7e82a500f80b02c7bbabf3929b6cb340bdc0ad8e9da265ae99d3e11f2744f16955895b60f23528d37aed2bbe4d1891d921a3ff64ecaf
|
7
|
+
data.tar.gz: 915f012ffa5cd6aef560a4dc5015a4b1ff105085576db06060752238e799c4fb170f33595c99ee8e39755ae135fb8695d772af5961c71dd533cb0d677a766e56
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
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.0] - 2022-06-10
|
7
|
+
- [#16](https://github.com/boltops-tools/terraspace_plugin_azurerm/pull/16) update generated backend key and ci interface
|
8
|
+
|
6
9
|
## [0.5.1] - 2022-05-03
|
7
10
|
- [#15](https://github.com/boltops-tools/terraspace_plugin_azurerm/pull/15) pascalCase
|
8
11
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# SUBSCRIPTION_HASH is a short 4-char consistent hash of the longer subscription id.
|
2
|
+
# LOCATION_HASH is a short 4-char consistent hash of the longer location.
|
2
3
|
# This is useful because azure storage account names are not allowed special characters and are limited to 24 chars.
|
3
4
|
terraform {
|
4
5
|
backend "azurerm" {
|
5
|
-
resource_group_name = "<%= expansion(':ENV-:LOCATION') %>"
|
6
|
-
storage_account_name = "<%= expansion('ts:SUBSCRIPTION_HASH:
|
6
|
+
resource_group_name = "<%= expansion(':APP-:ENV-:LOCATION') %>"
|
7
|
+
storage_account_name = "<%= expansion('ts:APP_HASH:SUBSCRIPTION_HASH:LOCATION_HASH:ENV') %>"
|
7
8
|
container_name = "terraform-state"
|
8
|
-
key = "<%= expansion(':
|
9
|
+
key = "<%= expansion(':TYPE_DIR/:APP/:ROLE/:MOD_NAME/:ENV/:EXTRA/:LOCATION/terraform.tfstate') %>"
|
9
10
|
}
|
10
11
|
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# SUBSCRIPTION_HASH is a short 4-char consistent hash of the longer subscription id.
|
2
|
+
# LOCATION_HASH is a short 4-char consistent hash of the longer location.
|
2
3
|
# This is useful because azure storage account names are not allowed special characters and are limited to 24 chars.
|
3
4
|
backend("azurerm",
|
4
|
-
resource_group_name: "
|
5
|
-
storage_account_name: "ts:SUBSCRIPTION_HASH:
|
5
|
+
resource_group_name: ":APP-:ENV-:LOCATION",
|
6
|
+
storage_account_name: "ts:APP_HASH:SUBSCRIPTION_HASH:LOCATION_HASH:ENV",
|
6
7
|
container_name: "terraform-state",
|
7
|
-
key: ":
|
8
|
+
key: ":TYPE_DIR/:APP/:ROLE/:MOD_NAME/:ENV/:EXTRA/:LOCATION/terraform.tfstate",
|
8
9
|
)
|
@@ -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.0
|
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-06-10 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
|