Skip to content

Commit

Permalink
fix: Update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
uanid committed Jan 9, 2024
1 parent 43a0b86 commit 21d7025
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 14 deletions.
53 changes: 46 additions & 7 deletions docs/data-sources/cidrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,56 @@ description: |-
## Example Usage

```terraform
data "bluechip_cidrs" "current" {
namespace = "office"
resource "bluechip_cidr" "c1" {
metadata {
name = "cidr1"
namespace = "default"
labels = {
"foo" = "bar"
}
annotations = {
"office" = "true"
"bluechip.example.com/location" = "seoul"
}
}
spec {
ipv4_cidrs = ["1.1.1.1/32"]
}
}
resource "bluechip_cidr" "c2" {
metadata {
name = "cidr2"
namespace = "default"
labels = {
"foo" = "bar"
}
annotations = {
"office" = "true"
"bluechip.example.com/location" = "tokyo"
}
}
spec {
ipv4_cidrs = ["1.1.1.1/32"]
}
}
data "bluechip_cidrs" "office" {
namespace = "default"
filter {
operator = "equal"
field = "metadata.annotations.office"
value = "true"
}
}
data "bluechip_cidrs" "current2" {
namespace = "office"
data "bluechip_cidrs" "seoul" {
namespace = "default"
filter {
operator = "fuzzy"
field = "metadata.name"
value = "console"
operator = "equal"
field = "metadata.annotations.bluechip.example.com/location"
value = "true"
}
}
```
Expand Down
53 changes: 46 additions & 7 deletions examples/data-sources/bluechip_cidrs/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,52 @@
data "bluechip_cidrs" "current" {
namespace = "office"
resource "bluechip_cidr" "c1" {
metadata {
name = "cidr1"
namespace = "default"
labels = {
"foo" = "bar"
}
annotations = {
"office" = "true"
"bluechip.example.com/location" = "seoul"
}
}
spec {
ipv4_cidrs = ["1.1.1.1/32"]
}
}

resource "bluechip_cidr" "c2" {
metadata {
name = "cidr2"
namespace = "default"
labels = {
"foo" = "bar"
}
annotations = {
"office" = "true"
"bluechip.example.com/location" = "tokyo"
}
}
spec {
ipv4_cidrs = ["1.1.1.1/32"]
}
}

data "bluechip_cidrs" "office" {
namespace = "default"
filter {
operator = "equal"
field = "metadata.annotations.office"
value = "true"
}
}

data "bluechip_cidrs" "current2" {
namespace = "office"
data "bluechip_cidrs" "seoul" {
namespace = "default"

filter {
operator = "fuzzy"
field = "metadata.name"
value = "console"
operator = "equal"
field = "metadata.annotations.bluechip.example.com/location"
value = "true"
}
}

0 comments on commit 21d7025

Please sign in to comment.