Skip to content

Commit b4a05eb

Browse files
authored
add standalone demo doc (#82)
add standalone demo doc Reviewed-by: Rodion Gyrbu <[email protected]> Reviewed-by: Anton Sidelnikov <None>
1 parent 84fc2cf commit b4a05eb

File tree

3 files changed

+89
-2
lines changed

3 files changed

+89
-2
lines changed

doc/source/examples/demo.rst

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Demo
2+
====
3+
4+
This article demonstrates how to install vault, add and configure plugin and
5+
perform invoke Terraform to query image_id for the image by name.
6+
7+
- Install vault
8+
9+
- Modify vault config file adding ``plugin_dir = "/opt/vault/plugin"``
10+
11+
- Deploy the plugin
12+
13+
.. code-block:: console
14+
15+
wget https://github.com/opentelekomcloud/vault-plugin-secrets-openstack/releases/download/v1.0.2/vault-plugin-secrets-openstack_1.0.2_linux_amd64.tar.gz
16+
tar xvf vault-plugin-secrets-openstack_1.0.2_linux_arm64.tar.gz -C /opt/vault/plugins
17+
18+
- Register the plugin
19+
20+
.. code-block::
21+
22+
vault secrets enable -path="openstack" -plugin-name="vault-plugin-secrets-openstack" plugin
23+
24+
- Register password policy
25+
26+
.. code-block::
27+
:caption: os_policy.hcl
28+
29+
length = 20
30+
rule "charset" {
31+
charset = "abcdefghijklmnopqrstuvwxyz"
32+
min-chars = 1
33+
}
34+
rule "charset" {
35+
charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
36+
min-chars = 1
37+
}
38+
rule "charset" {
39+
charset = "0123456789"
40+
min-chars = 1
41+
}
42+
rule "charset" {
43+
charset = "!@#$%^&*"
44+
min-chars = 1
45+
}
46+
47+
.. code-block:: console
48+
49+
vault write sys/policies/password/os-policy policy=@os_policy.hcl
50+
51+
52+
- Configure cloud root account
53+
54+
.. code-block::
55+
56+
vault write openstack/cloud/demo auth_url=https://<AUTH_URL> username=<USER> password=<PASSWORD> user_domain_name=<USER_DOMAIN_NAME> password_policy=os-policy
57+
58+
- Configure root token role
59+
60+
.. code-block:: console
61+
62+
vault write /openstack/role/root_token cloud=demo project_name=<PROJECT_NAME> domain_name=<DOMAIN_NAME> root=true
63+
64+
- Prepare Terraform configuration
65+
66+
.. literalinclude:: terraform_vault_openstack/settings.tf
67+
:caption: settings.tf
68+
69+
.. literalinclude:: terraform_vault_openstack/vault_os_creds.tf
70+
:caption: vault_os_cred.tf
71+
72+
.. literalinclude:: terraform_vault_openstack/variables.tf
73+
:caption: variables.tf
74+
75+
It is required to populate tenant_name (project_name) of the OpenStack
76+
provider when root token role is used.
77+
78+
- Apply Terraform plan
79+
80+
.. code-block:: console
81+
82+
terraform apply

doc/source/examples/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ There are multiple possibilities how to start using the plugin.
88

99
configure_tf
1010
use_tf
11+
demo

doc/source/examples/terraform_vault_openstack/settings.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ provider "vault" {
1616
address = var.vault_public_addr
1717
}
1818

19+
locals {
20+
auth = jsondecode(data.vault_generic_secret.token.data["auth"])
21+
}
22+
1923
provider "openstack" {
20-
auth_url = data.vault_generic_secret.token.data["auth_url"]
21-
token = data.vault_generic_secret.token.data["token"]
24+
auth_url = local.auth.auth_url
25+
token = local.auth.token
2226
tenant_name = var.project_name
2327
}

0 commit comments

Comments
 (0)