-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Backblaze B2 as S3 provider (#301)
Co-authored-by: gruberdev <[email protected]>
- Loading branch information
1 parent
9faf7fa
commit 50bd697
Showing
10 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ spec: | |
maxDuration: 15m | ||
ignoreDifferences: | ||
- group: "redis.redis.opstreelabs.in" | ||
kind: "Redis" | ||
kind: "Redis" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
<details> | ||
<summary> | ||
<b>Module documentation</b> | ||
</summary> | ||
|
||
--- | ||
<!-- BEGIN_TF_DOCS --> | ||
### Modules | ||
|
||
No modules. | ||
|
||
### Inputs | ||
|
||
| Name | Description | Type | Default | | ||
|------|-------------|------|---------| | ||
| app\_key | <sub>(Required) B2 Application Key. [Reference](https://registry.terraform.io/providers/Backblaze/b2/latest/docs#optional)</sub> | `string` | `""` | | ||
| app\_key\_id | <sub>(Required) B2 Application Key ID. [Reference](https://registry.terraform.io/providers/Backblaze/b2/latest/docs#optional)</sub> | `string` | `""` | | ||
| bucket\_name | <sub>A name for your S3 Bucket being created.</sub> | `string` | `"homelab-gruber"` | | ||
| bucket\_type | <sub>The bucket type. Either 'allPublic', meaning that files in this bucket can be downloaded by anybody, or 'allPrivate'. [Reference](https://registry.terraform.io/providers/Backblaze/b2/latest/docs/resources/bucket#required)</sub> | `string` | `"allPrivate"` | | ||
|
||
### Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| bucket\_example | n/a | | ||
<!-- END_TF_DOCS --> | ||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
resource "b2_bucket" "standard" { | ||
bucket_name = var.bucket_name | ||
bucket_type = var.bucket_type | ||
} | ||
|
||
data "b2_bucket" "standard" { | ||
bucket_name = b2_bucket.standard.bucket_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "bucket_example" { | ||
value = data.b2_bucket.standard | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
variable "app_key" { | ||
type = string | ||
description = "<sub>(Required) B2 Application Key. [Reference](https://registry.terraform.io/providers/Backblaze/b2/latest/docs#optional)</sub>" | ||
default = "" | ||
sensitive = true | ||
} | ||
|
||
variable "app_key_id" { | ||
type = string | ||
description = "<sub>(Required) B2 Application Key ID. [Reference](https://registry.terraform.io/providers/Backblaze/b2/latest/docs#optional)</sub>" | ||
default = "" | ||
sensitive = true | ||
} | ||
|
||
variable "bucket_type" { | ||
type = string | ||
description = "<sub>The bucket type. Either 'allPublic', meaning that files in this bucket can be downloaded by anybody, or 'allPrivate'. [Reference](https://registry.terraform.io/providers/Backblaze/b2/latest/docs/resources/bucket#required)</sub>" | ||
default = "allPrivate" | ||
validation { | ||
condition = can(index(["allPublic", "allPrivate"], var.bucket_type)) | ||
error_message = "Error: Not a valid bucket type." | ||
} | ||
} | ||
|
||
variable "bucket_name" { | ||
type = string | ||
default = "homelab-gruber" | ||
description = "<sub>A name for your S3 Bucket being created.</sub>" | ||
validation { | ||
condition = can(regex("^[a-z0-9][-a-z0-9]*[a-z0-9]$", var.bucket_name)) | ||
error_message = "Error: Invalid bucket name." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
terraform { | ||
backend "local" { | ||
} | ||
required_version = ">= 1.00" | ||
required_providers { | ||
b2 = { | ||
source = "Backblaze/b2" | ||
version = "0.8.4" | ||
} | ||
} | ||
} | ||
|
||
provider "b2" { | ||
application_key = var.app_key | ||
application_key_id = var.app_key_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters