Skip to content

Commit

Permalink
Make scope id a computed field in group resource, and fix dataprime s…
Browse files Browse the repository at this point in the history
…yntax in examples (#274)
  • Loading branch information
lootag authored Oct 4, 2024
1 parent 4f6c719 commit 1b769f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
9 changes: 5 additions & 4 deletions coralogix/data_source_coralogix_group.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2024 Coralogix Ltd.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -20,11 +20,12 @@ import (
"fmt"
"log"

"terraform-provider-coralogix/coralogix/clientset"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/resource"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"terraform-provider-coralogix/coralogix/clientset"
)

var _ datasource.DataSourceWithConfigure = &GroupDataSource{}
Expand Down
14 changes: 4 additions & 10 deletions examples/group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ provider "coralogix" {
#env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>"
}

resource "coralogix_custom_role" "example" {
name = "Example custom role"
description = "This role is created with terraform!"
parent_role = "Standard User"
permissions = ["spans.events2metrics:UpdateConfig"]
}

resource "coralogix_user" "example" {
user_name = "example@coralogix.com"
Expand All @@ -29,7 +23,7 @@ resource "coralogix_user" "example" {

resource "coralogix_scope" "example" {
display_name = "ExampleScope"
default_expression = "<v1> true"
default_expression = "<v1>true"
filters = [
{
entity_type = "logs"
Expand All @@ -39,9 +33,9 @@ resource "coralogix_scope" "example" {
}

resource "coralogix_group" "example" {
display_name = "example"
role = coralogix_custom_role.example.name
display_name = "example2"
role = "Read Only"
members = [coralogix_user.example.id]
scope_id = data.coralogix_scope.example.id
scope_id = coralogix_scope.example.id
}

4 changes: 2 additions & 2 deletions examples/scope/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ provider "coralogix" {

resource "coralogix_scope" "example" {
display_name = "ExampleScope"
default_expression = "<v1> true"
default_expression = "<v1>true"
filters = [
{
entity_type = "logs"
expression = "(subsystemName == 'purchases') || (subsystemName == 'signups')"
expression = "<v1>(subsystemName == 'purchases') || (subsystemName == 'signups')"
}
]
}
Expand Down

0 comments on commit 1b769f7

Please sign in to comment.