Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tag analytical cluster #583

Merged
merged 31 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fc1e115
feat: resource tag create
wai-wong-edb Mar 22, 2024
b06819a
fix: lint errors
wai-wong-edb Mar 22, 2024
bddbab4
fix: lint errors
wai-wong-edb Mar 22, 2024
07ba079
refactor: refactor tag client
wai-wong-edb Mar 28, 2024
714a365
feat: tag update
wai-wong-edb Mar 28, 2024
bdf1710
refactor: refactor tag client
wai-wong-edb Apr 2, 2024
086aaa7
Merge branch 'ww-tags-create' into ww-tags-update
wai-wong-edb Apr 2, 2024
cd08fe8
feat: changed tag description
wai-wong-edb Apr 2, 2024
c07f3bc
Merge branch 'ww-tags-create' into ww-tags-update
wai-wong-edb Apr 2, 2024
6a0235e
feat: tag import
wai-wong-edb Apr 2, 2024
67263ab
feat: lint error
wai-wong-edb Apr 2, 2024
e5a74f0
feat: assign tags to resources
wai-wong-edb Apr 5, 2024
7931b8b
fix: faraway replica assign tag
wai-wong-edb Apr 8, 2024
b04fa41
feat: tag in cluster examples
wai-wong-edb Apr 9, 2024
29ab369
fix: plan modifier for cluster to merge plan with state so it can dea…
wai-wong-edb Apr 9, 2024
7abe3a4
fix: cluster assign tags fix
wai-wong-edb Apr 11, 2024
496b51d
feat: pgd assign tags
wai-wong-edb Apr 11, 2024
cb47561
fix: lint fix
wai-wong-edb Apr 15, 2024
7027740
fix: examples
wai-wong-edb Apr 15, 2024
e4e58c8
feat: project tags assign
wai-wong-edb Apr 15, 2024
0364ce9
fix: planmodifier to use state so it can assign and remove correctly
wai-wong-edb Apr 15, 2024
b7dc43f
Merge branch 'main' into ww-tag-assign-pgd-project-region
wai-wong-edb Aug 14, 2024
bd4ae33
Merge branch 'main' into ww-tag-assign-pgd-project-region
wai-wong-edb Aug 19, 2024
4b97360
Merge branch 'ww-tag-assign-pgd-project-region' into ww-tag-assign-pr…
wai-wong-edb Aug 19, 2024
c165509
fix: custom plan modifier
wai-wong-edb Aug 19, 2024
3ce5ec9
feat: tag analytics cluster
wai-wong-edb Aug 21, 2024
79f979a
feat: examples and datasource
wai-wong-edb Aug 22, 2024
008cbda
fix: change example tag name
wai-wong-edb Aug 23, 2024
332a6cb
fix: data source description changes for analytics and faraway replic…
wai-wong-edb Sep 9, 2024
755c20f
Merge branch 'main' into ww-tag-analytical-cluster
wai-wong-edb Oct 4, 2024
697088f
fix: example naming
wai-wong-edb Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions examples/resources/biganimal_analytics_cluster/aws/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ resource "biganimal_analytics_cluster" "analytics_cluster" {
project_id = var.project_id
pause = false

#tags = [
# {
# tag_name = "wai-tag-3"
wai-wong-edb marked this conversation as resolved.
Show resolved Hide resolved
# color = "blue"
# },
# {
# tag_name = "wai-tag-4"
# },
#]

allowed_ip_ranges = [
{
cidr_block = "127.0.0.1/32"
Expand Down
4 changes: 2 additions & 2 deletions examples/resources/biganimal_cluster/ha/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ resource "biganimal_cluster" "ha_cluster" {

#tags = [
# {
# tag_name = "test-tag-1"
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# tag_name = "ex-tag-name-2"
# },
#]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ resource "biganimal_cluster" "single_node_cluster" {

#tags = [
# {
# tag_name = "test-tag-1"
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# tag_name = "ex-tag-name-2"
# },
#]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ resource "biganimal_cluster" "single_node_cluster" {

#tags = [
# {
# tag_name = "test-tag-1"
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# tag_name = "ex-tag-name-2"
# },
#]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ resource "biganimal_cluster" "single_node_cluster" {

#tags = [
# {
# tag_name = "test-tag-1"
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# tag_name = "ex-tag-name-2"
# },
#]

Expand Down
16 changes: 7 additions & 9 deletions examples/resources/biganimal_faraway_replica/aws/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ resource "biganimal_faraway_replica" "faraway_replica" {
private_networking = false
region = "ap-south-1"

#tags = [
# {
# tag_name = "test-tag-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# },
#]
#tags {
# tag_name = "ex-tag-name-1"
# color = "blue"
#}
#tags {
# tag_name = "ex-tag-name-2"
#}

# pe_allowed_principal_ids = [
# <example_value> # ex: 123456789012
Expand Down
16 changes: 7 additions & 9 deletions examples/resources/biganimal_faraway_replica/azure/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ resource "biganimal_faraway_replica" "faraway_replica" {
private_networking = false
region = "australiaeast"

#tags = [
# {
# tag_name = "test-tag-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# },
#]
#tags {
# tag_name = "ex-tag-name-1"
# color = "blue"
#}
#tags {
# tag_name = "ex-tag-name-2"
#}

# pe_allowed_principal_ids = [
# <example_value> # ex: "9334e5e6-7f47-aE61-5A4F-ee067daeEf4A"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,13 @@ resource "biganimal_faraway_replica" "faraway_replica" {
private_networking = false
region = "centralindia"

#tags = [
# {
# tag_name = "test-tag-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# },
#]
#tags {
# tag_name = "ex-tag-name-1"
# color = "blue"
#}
#tags {
# tag_name = "ex-tag-name-2"
#}

# transparent_data_encryption = {
# key_id = <example_value>
Expand Down
16 changes: 7 additions & 9 deletions examples/resources/biganimal_faraway_replica/gcp/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ resource "biganimal_faraway_replica" "faraway_replica" {
private_networking = false
region = "us-east1"

#tags = [
# {
# tag_name = "test-tag-1"
# color = "blue"
# },
# {
# tag_name = "test-tag-2"
# },
#]
#tags {
# tag_name = "ex-tag-name-1"
# color = "blue"
#}
#tags {
# tag_name = "ex-tag-name-2"
#}

# pe_allowed_principal_ids = [
# <example_value> # ex: "development-data-123456"
Expand Down
9 changes: 9 additions & 0 deletions examples/resources/biganimal_pgd/aws/data_group/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ resource "biganimal_pgd" "pgd_cluster" {
project_id = var.project_id
password = resource.random_password.password.result
pause = false
#tags = [
# {
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "ex-tag-name-2"
# },
#]
data_groups = [
{
allowed_ip_ranges = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ resource "biganimal_pgd" "pgd_cluster" {
project_id = var.project_id
password = resource.random_password.password.result
pause = false
#tags = [
# {
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "ex-tag-name-2"
# },
#]
data_groups = [
{
allowed_ip_ranges = [
Expand Down
9 changes: 9 additions & 0 deletions examples/resources/biganimal_pgd/azure/data_group/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ resource "biganimal_pgd" "pgd_cluster" {
project_id = var.project_id
password = resource.random_password.password.result
pause = false
#tags = [
# {
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "ex-tag-name-2"
# },
#]
data_groups = [
{
allowed_ip_ranges = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ resource "biganimal_pgd" "pgd_cluster" {
project_id = var.project_id
password = resource.random_password.password.result
pause = false
#tags = [
# {
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "ex-tag-name-2"
# },
#]
data_groups = [
{
allowed_ip_ranges = [
Expand Down
9 changes: 9 additions & 0 deletions examples/resources/biganimal_pgd/gcp/data_group/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ resource "biganimal_pgd" "pgd_cluster" {
project_id = var.project_id
password = resource.random_password.password.result
pause = false
#tags = [
# {
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "ex-tag-name-2"
# },
#]
data_groups = [
{
allowed_ip_ranges = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ resource "biganimal_pgd" "pgd_cluster" {
project_id = var.project_id
password = resource.random_password.password.result
pause = false
#tags = [
# {
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "ex-tag-name-2"
# },
#]
data_groups = [
{
allowed_ip_ranges = [
Expand Down
9 changes: 9 additions & 0 deletions examples/resources/biganimal_project/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ resource "random_pet" "project_name" {

resource "biganimal_project" "this" {
project_name = format("TF %s", title(random_pet.project_name.id))
#tags = [
# {
# tag_name = "ex-tag-name-1"
# color = "blue"
# },
# {
# tag_name = "ex-tag-name-2"
# },
#]
}

output "project_name" {
Expand Down
21 changes: 0 additions & 21 deletions pkg/api/beacon_analytics_client.go

This file was deleted.

17 changes: 13 additions & 4 deletions pkg/api/project_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ func NewProjectClient(api API) *ProjectClient {
return &c
}

func (c ProjectClient) Create(ctx context.Context, projectName string) (string, error) {
func (c ProjectClient) Create(ctx context.Context, model any) (string, error) {
response := struct {
Data struct {
ProjectId string `json:"projectId"`
} `json:"data"`
}{}

project := map[string]string{"projectName": projectName}
projectRs := model.(models.Project)
project := map[string]interface{}{
"projectName": projectRs.ProjectName,
"tags": projectRs.Tags,
}

b, err := json.Marshal(project)
if err != nil {
Expand Down Expand Up @@ -83,14 +87,19 @@ func (c ProjectClient) List(ctx context.Context, query string) ([]*models.Projec
return response.Data, err
}

func (c ProjectClient) Update(ctx context.Context, projectId, projectName string) (string, error) {
func (c ProjectClient) Update(ctx context.Context, projectId, model any) (string, error) {
response := struct {
Data struct {
ProjectId string `json:"projectId"`
} `json:"data"`
}{}

project := map[string]string{"projectName": projectName}
projectRs := model.(models.Project)
project := map[string]interface{}{
"projectName": projectRs.ProjectName,
"tags": projectRs.Tags,
}

b, err := json.Marshal(project)
if err != nil {
return "", err
Expand Down
3 changes: 3 additions & 0 deletions pkg/models/project.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package models

import commonApi "github.com/EnterpriseDB/terraform-provider-biganimal/pkg/models/common/api"

type CloudProvider struct {
CloudProviderId string `json:"cloudProviderId,omitempty" tfsdk:"cloud_provider_id"`
CloudProviderName string `json:"cloudProviderName,omitempty" tfsdk:"cloud_provider_name"`
Expand All @@ -11,6 +13,7 @@ type Project struct {
UserCount int `json:"userCount,omitempty" tfsdk:"user_count"`
ClusterCount int `json:"clusterCount,omitempty" tfsdk:"cluster_count"`
CloudProviders []CloudProvider `json:"cloudProviders" tfsdk:"cloud_providers"`
Tags []commonApi.Tag `json:"tags,omitempty"`
}

// Check the return value, if ProjectName is also needed
Expand Down
Loading
Loading