Skip to content

Commit da9d527

Browse files
author
Sohan
committed
update
0 parents  commit da9d527

File tree

12 files changed

+318
-0
lines changed

12 files changed

+318
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ignored files
2+
*.tfstate
3+
*.tfstate.backup
4+
.terraform
5+
.idea
6+
*.iml

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: git://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.12.0
4+
hooks:
5+
- id: terraform_fmt
6+
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v2.0.0
9+
hooks:
10+
- id: check-merge-conflict
11+
- id: trailing-whitespace
12+
- id: check-yaml
13+
- id: check-added-large-files

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Cloud Drove
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export GENIE_PATH ?= $(shell 'pwd')/../../../../genie
2+
3+
include $(GENIE_PATH)/Makefile

README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<!-- This file was automatically generated by the `geine`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
2+
3+
4+
<h1 align="center">
5+
Terraform DigitalOcean SSH Key
6+
</h1>
7+
8+
<p align="center" style="font-size: 1.2rem;">
9+
Provides a DigitalOcean SSH key resource to allow you to manage SSH keys for Droplet access.
10+
</p>
11+
12+
<p align="center">
13+
14+
<a href="https://www.terraform.io">
15+
<img src="https://img.shields.io/badge/Terraform-v0.12-green" alt="Terraform">
16+
</a>
17+
<a href="LICENSE.md">
18+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="Licence">
19+
</a>
20+
21+
22+
</p>
23+
<p align="center">
24+
25+
<a href='https://facebook.com/sharer/sharer.php?u=https://github.com/clouddrove/terraform-digitalocean-ssh-key'>
26+
<img title="Share on Facebook" src="https://user-images.githubusercontent.com/50652676/62817743-4f64cb80-bb59-11e9-90c7-b057252ded50.png" />
27+
</a>
28+
<a href='https://www.linkedin.com/shareArticle?mini=true&title=Terraform+DigitalOcean+SSH+Key&url=https://github.com/clouddrove/terraform-digitalocean-ssh-key'>
29+
<img title="Share on LinkedIn" src="https://user-images.githubusercontent.com/50652676/62817742-4e339e80-bb59-11e9-87b9-a1f68cae1049.png" />
30+
</a>
31+
<a href='https://twitter.com/intent/tweet/?text=Terraform+DigitalOcean+SSH+Key&url=https://github.com/clouddrove/terraform-digitalocean-ssh-key'>
32+
<img title="Share on Twitter" src="https://user-images.githubusercontent.com/50652676/62817740-4c69db00-bb59-11e9-8a79-3580fbbf6d5c.png" />
33+
</a>
34+
35+
</p>
36+
<hr>
37+
38+
39+
40+
41+
42+
## Prerequisites
43+
44+
This module has a few dependencies:
45+
46+
47+
48+
49+
50+
51+
52+
53+
**IMPORTANT:** Since the `master` branch used in `source` varies based on new modifications, we suggest that you use the release versions [here](https://github.com/clouddrove/terraform-digitalocean-ssh-key/releases).
54+
55+
56+
### Simple Example
57+
Here is an example of how you can use this module in your inventory structure:
58+
```hcl
59+
module "ssh-key" {
60+
source = "./../"
61+
key = "~/.ssh/id_rsa.pub"
62+
key_name = "devops"
63+
enable_ssh_key = true
64+
}
65+
```
66+
67+
68+
69+
70+
71+
72+
## Inputs
73+
74+
| Name | Description | Type | Default | Required |
75+
|------|-------------|:----:|:-----:|:-----:|
76+
| enable_ssh_key | A boolean flag to enable/disable ssh key. | bool | `true` | no |
77+
| key_name | Name (e.g. `it-admin` or `devops`). | string | `` | no |
78+
| key_path | Name (e.g. `~/.ssh/id_rsa.pub` or `ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQ`). | string | `` | no |
79+
80+
## Outputs
81+
82+
| Name | Description |
83+
|------|-------------|
84+
| id | The unique ID of the key. |
85+
| name | Name of SSH key. |
86+
| public_key | The text of the public key. |
87+
88+
89+
90+
91+
92+
93+
## Feedback
94+
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/terraform-digitalocean-ssh-key/issues), or feel free to drop us an email at [[email protected]](mailto:[email protected]).
95+
96+
If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/terraform-digitalocean-ssh-key)!
97+
98+
## About us
99+
100+
At [CloudDrove][website], we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.
101+
102+
<p align="center">We are <b> The Cloud Experts!</b></p>
103+
<hr />
104+
<p align="center">We ❤️ <a href="https://github.com/clouddrove">Open Source</a> and you can check out <a href="https://github.com/clouddrove">our other modules</a> to get help with your new Cloud ideas.</p>
105+
106+
[website]: https://clouddrove.com
107+
[github]: https://github.com/clouddrove
108+
[linkedin]: https://cpco.io/linkedin
109+
[twitter]: https://twitter.com/clouddrove/
110+
[email]: https://clouddrove.com/contact-us.html
111+
[terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language=

README.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
#
3+
# This is the canonical configuration for the `README.md`
4+
# Run `make readme` to rebuild the `README.md`
5+
#
6+
7+
# Name of this project
8+
name : Terraform DigitalOcean SSH Key
9+
10+
# License of this project
11+
license: "MIT"
12+
13+
# Canonical GitHub repo
14+
github_repo: clouddrove/terraform-digitalocean-ssh-key
15+
16+
# Badges to display
17+
badges:
18+
- name: "Terraform"
19+
image: "https://img.shields.io/badge/Terraform-v0.12-green"
20+
url: "https://www.terraform.io"
21+
- name: "Licence"
22+
image: "https://img.shields.io/badge/License-MIT-blue.svg"
23+
url: "LICENSE.md"
24+
25+
# description of this project
26+
description: |-
27+
Provides a DigitalOcean SSH key resource to allow you to manage SSH keys for Droplet access.
28+
29+
# extra content
30+
include:
31+
- "terraform.md"
32+
33+
# How to use this project
34+
usage : |-
35+
### Simple Example
36+
Here is an example of how you can use this module in your inventory structure:
37+
```hcl
38+
module "ssh-key" {
39+
source = "./../"
40+
key = "~/.ssh/id_rsa.pub"
41+
key_name = "devops"
42+
enable_ssh_key = true
43+
}
44+
```

_example/example.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
provider "digitalocean" {
3+
# You need to set this in your .bashrc
4+
# export DIGITALOCEAN_TOKEN="Your API TOKEN"
5+
#
6+
}
7+
8+
module "custom_certificate" {
9+
source = "./../"
10+
certificate_name = "test"
11+
private_key = "./../../../clouddrove-private-key.pem"
12+
certificate_chain = "./../../../clouddrove-cert.pem"
13+
leaf_certificate = "./../../../clouddrove-chain.crt"
14+
custom_certificate = true
15+
}
16+
17+
18+
module "lets_encrypt_certificate" {
19+
source = "./../"
20+
certificate_name = "test"
21+
domain_names = ["clouddrove.com"]
22+
lets_encrypt_certificate = true
23+
}
24+
25+
26+

_example/outputs.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//output "name" {
2+
// value = module.ssh-key.*.name
3+
// description = "Name of SSH key."
4+
//}
5+
//output "id" {
6+
// value = module.ssh-key.*.id
7+
// description = "The unique ID of the key."
8+
//}
9+
//
10+
//output "public_key" {
11+
// value = module.ssh-key.*.public_key
12+
// description = "The text of the public key."
13+
//}
14+
//

main.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Managed By : CloudDrove
2+
##Description : This Script is used to create Certificate Key.
3+
## Copyright @ CloudDrove. All Right Reserved.
4+
5+
#Module : Certificate
6+
#Description :Provides a DigitalOcean Certificate resource that allows you to manage certificates.
7+
resource "digitalocean_certificate" "custom" {
8+
count = var.enable_certificate && var.custom_certificate == true ? 1 : 0
9+
10+
name = var.certificate_name
11+
type = "custom"
12+
private_key = file(var.private_key)
13+
leaf_certificate = file(var.leaf_certificate)
14+
certificate_chain = file(var.certificate_chain)
15+
}
16+
17+
#Module : Certificate
18+
#Description :Provides a DigitalOcean Certificate resource that allows you to manage certificates.
19+
resource "digitalocean_certificate" "lets_encrypt" {
20+
count = var.enable_certificate && var.lets_encrypt_certificate == true ? 1 : 0
21+
22+
name = var.certificate_name
23+
type = "lets_encrypt"
24+
domains = var.domain_names
25+
}

outputs.tf

Whitespace-only changes.

0 commit comments

Comments
 (0)