add provider doc
This commit is contained in:
parent
ae11713fc7
commit
f881698320
7 changed files with 288 additions and 10 deletions
|
@ -52,7 +52,7 @@ classDiagram
|
|||
### build.py
|
||||
|
||||
```python
|
||||
from subprocess import run
|
||||
from os import environ
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ classDiagram
|
|||
### build.py
|
||||
|
||||
```python
|
||||
from subprocess import run
|
||||
from os import environ
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
|
||||
|
@ -113,7 +113,3 @@ def tf_import(project):
|
|||
```bash
|
||||
pyb image plan apply destroy
|
||||
```
|
||||
|
||||
### full example
|
||||
|
||||
... can be found [here](../infrastructure/devops-build)
|
||||
|
|
90
doc/DevopsTerraformBuildWithAwsProvider.md
Normal file
90
doc/DevopsTerraformBuildWithAwsProvider.md
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Aws Provider
|
||||
|
||||
## Input
|
||||
|
||||
| name | description | default |
|
||||
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------- |
|
||||
| aws_as_backend | you can use aws s3 as backend state storage | False |
|
||||
| aws_region | in case of backend usage | "eu-central-1" |
|
||||
| aws_bucket | in case of backend usage, the bucket your state is stored in. the url is S3://{aws_bucket}/{aws_bucket_key}/{aws_account_name} | |
|
||||
| aws_bucket_key | | {module} |
|
||||
| aws_account_name | | {stage} |
|
||||
| aws_bucket_kms_key_id | in case of backend usage, kms key for encrypting your state | |
|
||||
|
||||
### Credentials Mapping defaults
|
||||
#### without a defined provider
|
||||
|
||||
```python
|
||||
[
|
||||
]
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
### build.py
|
||||
|
||||
```python
|
||||
from os import environ
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
|
||||
name = 'my-project'
|
||||
MODULE = 'my-module'
|
||||
PROJECT_ROOT_PATH = '..'
|
||||
|
||||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on("ddadevops>=4.0.0")
|
||||
|
||||
input = {
|
||||
"credentials_mapping": [],
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"stage": environ["STAGE"],
|
||||
"project_root_path": PROJECT_ROOT_PATH,
|
||||
"build_types": ["TERRAFORM"],
|
||||
"mixin_types": [],
|
||||
"tf_provider_types": ["AWS"],
|
||||
"tf_use_workspace": False,
|
||||
"tf_terraform_semantic_version": "1.4.2",
|
||||
"aws_as_backend": True,
|
||||
"aws_bucket": "your-configuration",
|
||||
"aws_bucket_kms_key_id": "your-kms-key-id",
|
||||
}
|
||||
|
||||
build = DevopsTerraformBuild(project, config)
|
||||
build.initialize_build_dir()
|
||||
|
||||
|
||||
@task
|
||||
def plan(project):
|
||||
build = get_devops_build(project)
|
||||
build.plan()
|
||||
|
||||
|
||||
@task
|
||||
def apply(project):
|
||||
build = get_devops_build(project)
|
||||
build.apply(True)
|
||||
|
||||
|
||||
@task
|
||||
def destroy(project):
|
||||
build = get_devops_build(project)
|
||||
build.destroy()
|
||||
|
||||
|
||||
@task
|
||||
def tf_import(project):
|
||||
build = get_devops_build(project)
|
||||
build.tf_import(
|
||||
"terraform.resource", "providers id"
|
||||
)
|
||||
```
|
||||
|
||||
### call the build
|
||||
|
||||
```bash
|
||||
pyb image plan apply destroy
|
||||
```
|
106
doc/DevopsTerraformBuildWithDigitaloceanProvider.md
Normal file
106
doc/DevopsTerraformBuildWithDigitaloceanProvider.md
Normal file
|
@ -0,0 +1,106 @@
|
|||
# Digitalocean Provider
|
||||
|
||||
## Input
|
||||
|
||||
| name | description | default |
|
||||
| -------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
||||
| do_api_key | the do api key | |
|
||||
| do_as_backend | you can use do s3 as backend state storage | False |
|
||||
| do_spaces_access_id | in case of backend usage | |
|
||||
| do_spaces_secret_key | in case of backend usage | |
|
||||
| do_endpoint | in case of backend usage | "fra1.digitaloceanspaces.com" |
|
||||
| do_region | in case of backend usage | "eu-central-1" |
|
||||
| do_bucket | in case of backend usage, the bucket your state is stored in. the url is S3://{do_bucket}/{do_bucket_key}/{do_account_name} | |
|
||||
| do_bucket_key | | {module} |
|
||||
| do_account_name | | {stage} |
|
||||
|
||||
### Credentials Mapping defaults
|
||||
|
||||
```python
|
||||
[
|
||||
{
|
||||
"gopass_path": "server/devops/digitalocean/s3",
|
||||
"gopass_field": "id",
|
||||
"name": "do_spaces_access_id",
|
||||
},
|
||||
{
|
||||
"gopass_path": "server/devops/digitalocean/s3",
|
||||
"gopass_field": "secret",
|
||||
"name": "do_spaces_secret_key",
|
||||
},
|
||||
]
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
### build.py
|
||||
|
||||
```python
|
||||
from os import environ
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
|
||||
name = 'my-project'
|
||||
MODULE = 'my-module'
|
||||
PROJECT_ROOT_PATH = '..'
|
||||
|
||||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on("ddadevops>=4.0.0")
|
||||
|
||||
input = {
|
||||
"credentials_mapping": [
|
||||
{
|
||||
"gopass_path": environ.get("DIGITALOCEAN_TOKEN_KEY_PATH", None),
|
||||
"name": "do_api_key",
|
||||
},
|
||||
],
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"stage": environ["STAGE"],
|
||||
"project_root_path": PROJECT_ROOT_PATH,
|
||||
"build_types": ["TERRAFORM"],
|
||||
"mixin_types": [],
|
||||
"tf_provider_types": ["DIGITALOCEAN"],
|
||||
"tf_use_workspace": False,
|
||||
"tf_terraform_semantic_version": "1.4.2",
|
||||
"do_as_backend": True,
|
||||
"do_bucket": "your-configuration",
|
||||
}
|
||||
|
||||
build = DevopsTerraformBuild(project, config)
|
||||
build.initialize_build_dir()
|
||||
|
||||
|
||||
@task
|
||||
def plan(project):
|
||||
build = get_devops_build(project)
|
||||
build.plan()
|
||||
|
||||
|
||||
@task
|
||||
def apply(project):
|
||||
build = get_devops_build(project)
|
||||
build.apply(True)
|
||||
|
||||
|
||||
@task
|
||||
def destroy(project):
|
||||
build = get_devops_build(project)
|
||||
build.destroy()
|
||||
|
||||
|
||||
@task
|
||||
def tf_import(project):
|
||||
build = get_devops_build(project)
|
||||
build.tf_import(
|
||||
"terraform.resource", "providers id"
|
||||
)
|
||||
```
|
||||
|
||||
### call the build
|
||||
|
||||
```bash
|
||||
pyb image plan apply destroy
|
||||
```
|
89
doc/DevopsTerraformBuildWithHetznerProvider.md
Normal file
89
doc/DevopsTerraformBuildWithHetznerProvider.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
# Hetzner Provider
|
||||
|
||||
|
||||
|
||||
## Input
|
||||
|
||||
| name | description | default |
|
||||
| --------------- | ------------------- | ------- |
|
||||
| hetzner_api_key | the hetzner api key | |
|
||||
| |
|
||||
|
||||
### Credentials Mapping defaults
|
||||
|
||||
```python
|
||||
[
|
||||
]
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
### build.py
|
||||
|
||||
```python
|
||||
from os import environ
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
|
||||
name = 'my-project'
|
||||
MODULE = 'my-module'
|
||||
PROJECT_ROOT_PATH = '..'
|
||||
|
||||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on("ddadevops>=4.0.0")
|
||||
|
||||
input = {
|
||||
"credentials_mapping": [
|
||||
{
|
||||
"gopass_path": environ.get("HETZNER_API_KEY_PATH", None),
|
||||
"name": "hetzner_api_key",
|
||||
},
|
||||
],
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"stage": environ["STAGE"],
|
||||
"project_root_path": PROJECT_ROOT_PATH,
|
||||
"build_types": ["TERRAFORM"],
|
||||
"mixin_types": [],
|
||||
"tf_provider_types": ["HETZNER"],
|
||||
"tf_use_workspace": False,
|
||||
"tf_terraform_semantic_version": "1.4.2",
|
||||
}
|
||||
|
||||
build = DevopsTerraformBuild(project, config)
|
||||
build.initialize_build_dir()
|
||||
|
||||
|
||||
@task
|
||||
def plan(project):
|
||||
build = get_devops_build(project)
|
||||
build.plan()
|
||||
|
||||
|
||||
@task
|
||||
def apply(project):
|
||||
build = get_devops_build(project)
|
||||
build.apply(True)
|
||||
|
||||
|
||||
@task
|
||||
def destroy(project):
|
||||
build = get_devops_build(project)
|
||||
build.destroy()
|
||||
|
||||
|
||||
@task
|
||||
def tf_import(project):
|
||||
build = get_devops_build(project)
|
||||
build.tf_import(
|
||||
"terraform.resource", "providers id"
|
||||
)
|
||||
```
|
||||
|
||||
### call the build
|
||||
|
||||
```bash
|
||||
pyb image plan apply destroy
|
||||
```
|
|
@ -15,7 +15,7 @@ class Digitalocean(Validateable, CredentialMappingDefault):
|
|||
self.do_as_backend = inp.get("do_as_backend", False)
|
||||
self.do_account_name = inp.get("do_account_name", self.stage)
|
||||
self.do_bucket = inp.get("do_bucket")
|
||||
self.do_bucket_key = inp.get("do_bucket_key")
|
||||
self.do_bucket_key = inp.get("do_bucket_key", self.module)
|
||||
self.do_endpoint = inp.get("do_endpoint", "fra1.digitaloceanspaces.com")
|
||||
self.do_region = inp.get("do_region", "eu-central-1")
|
||||
|
||||
|
|
|
@ -37,9 +37,6 @@ def devops_config(overrides: dict) -> dict:
|
|||
"do_api_key": "api_key",
|
||||
"do_spaces_access_id": "spaces_id",
|
||||
"do_spaces_secret_key": "spaces_secret",
|
||||
"do_api_key": "api_key",
|
||||
"do_spaces_access_id": "spaces_id",
|
||||
"do_spaces_secret_key": "spaces_secret",
|
||||
"do_as_backend": True,
|
||||
"do_endpoint": "endpoint",
|
||||
"do_bucket": "bucket",
|
||||
|
|
Loading…
Reference in a new issue