Skip to content

Commit

Permalink
Merge pull request #2 from terraform-do-modules/internal-424
Browse files Browse the repository at this point in the history
fix: update source of labels module and readme.yml file
  • Loading branch information
anmolnagpal authored Jul 25, 2023
2 parents aacc27f + 5dd2473 commit b7afe57
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 36 deletions.
7 changes: 3 additions & 4 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ badges:

# description of this project
description: |-
spaces are virtual networks containing resources that can communicate with each other in full isolation, using private IP addresses.
Terraform module to create Digitalocean spaces service resource on Digitalocean.
# extra content
include:
- "terraform.md"
Expand All @@ -38,7 +37,7 @@ usage : |-
```hcl
module "spaces" {
source = "terraform-do-modules/spaces/digitalocean"
version = "0.15.0"
version = "1.0.0"
name = "spaces"
environment = "test"
acl = "private"
Expand All @@ -50,7 +49,7 @@ usage : |-
```hcl
module "spaces" {
source = "terraform-do-modules/spaces/digitalocean"
version = "0.15.0"
version = "1.0.0"
name = "spaces"
environment = "test"
acl = "private"
Expand Down
2 changes: 0 additions & 2 deletions _examples/basic/example.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
provider "digitalocean" {
spaces_access_id = "xxxxxxxxxxxxxxxxxxxx"
spaces_secret_key = "xxxxxxxxxxxxxxxxxxxx"
}

##------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions _examples/complete/example.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
provider "digitalocean" {
spaces_access_id = "xxxxxxxxxxxxxxxxxxxx"
spaces_secret_key = "xxxxxxxxxxxxxxxxxxxx"
}

##------------------------------------------------
Expand Down
34 changes: 15 additions & 19 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@
## Labels module callled that will be used for naming and tags.
##-----------------------------------------------------------------------------
module "labels" {
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-labels.git?ref=internal-426m"
source = "terraform-do-modules/labels/digitalocean"
version = "1.0.0"
name = var.name
environment = var.environment
managedby = var.managedby
label_order = var.label_order
}

#Module : Spaces
#Description : Provides a bucket resource for Spaces, DigitalOcean's object storage product.

##-----------------------------------------------------------------------------
##Description : Provides a bucket resource for Spaces, DigitalOcean's object storage product.
##-----------------------------------------------------------------------------
resource "digitalocean_spaces_bucket" "spaces" {
count = var.enabled ? 1 : 0
name = module.labels.id
region = var.region
acl = var.acl

count = var.enabled ? 1 : 0
name = module.labels.id
region = var.region
acl = var.acl
force_destroy = var.force_destroy

dynamic "cors_rule" {
for_each = var.cors_rule == null ? [] : var.cors_rule

content {
allowed_headers = cors_rule.value.allowed_headers
allowed_methods = cors_rule.value.allowed_methods
Expand All @@ -41,9 +40,8 @@ resource "digitalocean_spaces_bucket" "spaces" {
dynamic "expiration" {
for_each = var.expiration
content {
date = lookup(expiration.value, "date", null)
days = lookup(expiration.value, "days", null)

date = lookup(expiration.value, "date", null)
days = lookup(expiration.value, "days", null)
expired_object_delete_marker = lookup(expiration.value, "expired_object_delete_marker", false)
}
}
Expand All @@ -52,19 +50,17 @@ resource "digitalocean_spaces_bucket" "spaces" {
}
}
}

versioning {
enabled = var.versioning
}

}


##-----------------------------------------------------------------------------
#Description : The digitalocean_spaces_bucket_policy resource allows Terraform to attach bucket policy to Spaces.
##-----------------------------------------------------------------------------
resource "digitalocean_spaces_bucket_policy" "foobar" {
count = var.enabled && var.policy != null ? 1 : 0

count = var.enabled && var.policy != null ? 1 : 0
region = join("", digitalocean_spaces_bucket.spaces[*].region)
bucket = join("", digitalocean_spaces_bucket.spaces[*].name)
policy = var.policy
}

20 changes: 11 additions & 9 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ variable "region" {
#Module : spaces
#Description : Provides a bucket resource for Spaces, DigitalOcean's object storage product.


variable "acl" {
type = string
default = null
Expand Down Expand Up @@ -64,23 +63,26 @@ variable "cors_rule" {
description = "CORS Configuration specification for this bucket"
}


variable "lifecycle_rule" {
type = list(any)
default = []
type = list(any)
default = []
description = "A configuration of object lifecycle management (documented below)."
}

variable "expiration" {
type = list(any)
default = []
type = list(any)
default = []
description = "Specifies a time period after which applicable objects expire (documented below)."
}

variable "policy" {
type = any
default = null
type = any
default = null
description = "The text of the policy."
}

variable "enabled" {
type = bool
default = true
description = "Whether to create the resources. Set to `false` to prevent the module from creating any resources."
}
}

0 comments on commit b7afe57

Please sign in to comment.