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

Merge into Main #186

Merged
merged 32 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a28f34d
one click access for rdp changes (#168)
rohitSangamnerkar Apr 24, 2024
d598cae
tunnel_policy changes add new fields name and description (#169)
rohitSangamnerkar Apr 24, 2024
62136a6
remove default l4 policy checks
nareshkakubal Apr 24, 2024
7e2d2b0
remove default l4 policy checks
nareshkakubal Apr 25, 2024
aa02875
mask inputs
nareshkakubal Apr 25, 2024
be73b4a
revert masking
nareshkakubal Apr 25, 2024
ba26a64
fix ATG test case (#171)
rohitSangamnerkar Apr 30, 2024
06c5513
update documentation
nareshkakubal Apr 30, 2024
a9ed3d8
address review comment
nareshkakubal May 3, 2024
517922e
Service tunnel policy and rdp setting feature addition. (#170) (#173)
nareshkakubal Jun 4, 2024
08dae67
Service tunnel policy and rdp setting feature addition. (#170) (#173)
nareshkakubal Jun 4, 2024
f92f33e
add description field to applicable resources (#184)
rohitSangamnerkar Oct 10, 2024
d12d4d5
set tls insecure value correctly (#185)
rohitSangamnerkar Oct 10, 2024
6529f30
Terraform changes to support NRPT option at ORG level (#175)
nareshkakubal Jul 18, 2024
0ee041a
BC-13824: Add deployment property to connector spec (#177) (#178)
nareshkakubal Aug 26, 2024
f6abbd0
fix releaser args to --clean (#179)
nareshkakubal Aug 28, 2024
4796bcf
revert go releaser to v5 (#180)
nareshkakubal Sep 5, 2024
97f68ad
Service tunnel configuration support (#181)
nareshkakubal Sep 15, 2024
b12d16b
fix applications block conversion (#182)
nareshkakubal Sep 16, 2024
1742f47
fix description tag
nareshkakubal Oct 10, 2024
49b0530
Merge remote-tracking branch 'origin/main' into dev
nareshkakubal Oct 10, 2024
6a30b36
Documentation generated
invalid-email-address Oct 10, 2024
7df2401
allow setting post redirect url in webservice (#187)
rohitSangamnerkar Oct 16, 2024
2e9e10b
Documentation generated
invalid-email-address Oct 16, 2024
35fb815
add support to set tls_sni in web service (#188)
rohitSangamnerkar Oct 16, 2024
ceca312
fix merge conflict
nareshkakubal Oct 16, 2024
8619507
add support to set enforcing and permissive mode for services (#189)
rohitSangamnerkar Oct 17, 2024
2c5c265
fix merge conflict
nareshkakubal Oct 17, 2024
883bdda
fix test case (#191)
rohitSangamnerkar Oct 17, 2024
b95a311
Documentation generated
invalid-email-address Oct 17, 2024
6318a6e
BC-14790 : Ability to Enable / Disable service like on the console fo…
OmkeshJosh Oct 18, 2024
435886e
Documentation generated
invalid-email-address Oct 18, 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
12 changes: 12 additions & 0 deletions banyan/resource_accesstier.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ func AccessTierSchema() map[string]*schema.Schema {
Optional: true,
Description: "Timeout value for service discovery batch processing",
},
"description": {
Type: schema.TypeString,
Optional: true,
Description: "description of an access tier",
},
}
return s
}
Expand Down Expand Up @@ -383,6 +388,12 @@ func resourceAccessTierRead(ctx context.Context, d *schema.ResourceData, m inter
if err != nil {
return diag.FromErr(err)
}

err = d.Set("description", at.Description)
if err != nil {
return diag.FromErr(err)
}

err = flattenTunnelConfigSatellite(d, &at)
if err != nil {
return diag.FromErr(err)
Expand Down Expand Up @@ -431,6 +442,7 @@ func atFromState(d *schema.ResourceData, clusterName string) (accessTier accesst
DisableSnat: d.Get("disable_snat").(bool),
SrcNATCIDRRange: d.Get("src_nat_cidr_range").(string),
ApiKeyId: d.Get("api_key_id").(string),
Description: d.Get("description").(string),
}
return at
}
Expand Down
11 changes: 11 additions & 0 deletions banyan/resource_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func resourceConnector() *schema.Resource {
Optional: true,
Description: "The method used for the deployment of the satellite.",
},
"description": {
Type: schema.TypeString,
Optional: true,
Description: "description of connector",
},
},
}
}
Expand All @@ -95,6 +100,7 @@ func connectorFromState(d *schema.ResourceData) (info satellite.Info) {
Metadata: satellite.Metadata{
Name: d.Get("name").(string),
DisplayName: d.Get("name").(string),
Description: d.Get("description").(string),
},
Spec: satellite.Spec{
APIKeyID: d.Get("api_key_id").(string),
Expand Down Expand Up @@ -154,6 +160,11 @@ func resourceConnectorRead(ctx context.Context, d *schema.ResourceData, m interf
if err != nil {
return diag.FromErr(err)
}

err = d.Set("description", sat.Description)
if err != nil {
return diag.FromErr(err)
}
return
}

Expand Down
6 changes: 6 additions & 0 deletions banyan/resource_service_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ func DbSchema() map[string]*schema.Schema {
Default: true,
Description: "Allow the end user to override the backend_port for this service",
},
"policy_enforcing": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "mode in which policy should be. If this is true policy is in enforcing mode else policy is in Permissive mode",
},
}
}

Expand Down
6 changes: 6 additions & 0 deletions banyan/resource_service_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ func K8sSchema() map[string]*schema.Schema {
Default: true,
Description: "Allow the end user to override the backend_port for this service",
},
"policy_enforcing": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "mode in which policy should be. If this is true policy is in enforcing mode else policy is in Permissive mode",
},
}
}

Expand Down
104 changes: 104 additions & 0 deletions banyan/resource_service_k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestAccService_k8s(t *testing.T) {
client_kube_cluster_name = "k8s-cluster"
client_kube_ca_key = "k8scAk3yH3re"
client_banyanproxy_listen_port = "9119"
policy_enforcing = false
}
`, rName, rName, rName),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -67,3 +68,106 @@ func TestAccService_k8s(t *testing.T) {
},
})
}

func TestAccK8Service_basic(t *testing.T) {

rName := fmt.Sprintf("tf-acc-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))

resource.Test(t, resource.TestCase{
Providers: testAccProviders,
CheckDestroy: nil,
Steps: []resource.TestStep{
//test case with policy enforce
{
Config: fmt.Sprintf(`
resource "banyan_api_key" "example" {
name = "%s"
description = "realdescription"
scope = "access_tier"
}

resource banyan_accesstier "example" {
name = "%s"
address = "*.example.com"
api_key_id = banyan_api_key.example.id
}

resource "banyan_policy_infra" "example" {
name = "%s"
description = "some tunnel policy description"
access {
roles = ["ANY"]
trust_level = "High"
}
}

resource "banyan_service_k8s" "example" {
name = "%s"
description = "realdescription"
access_tier = banyan_accesstier.example.name
domain = "test-k8s.corp.com"
policy = banyan_policy_infra.example.id
policy_enforcing = false
backend_dns_override_for_domain = "test-k8s.service"
client_kube_cluster_name = "k8s-cluster"
client_kube_ca_key = "k8scAk3yH3re"
client_banyanproxy_listen_port = "9119"
}
`, rName, rName, rName, rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("banyan_service_k8s.example", "name", rName),
),
},
{
ResourceName: "banyan_service_k8s.example",
ImportState: true,
ImportStateVerify: true,
},
// test case without policy enforcing
{
Config: fmt.Sprintf(`
resource "banyan_api_key" "example" {
name = "%s"
description = "realdescription"
scope = "access_tier"
}

resource banyan_accesstier "example" {
name = "%s"
address = "*.example.com"
api_key_id = banyan_api_key.example.id
}

resource "banyan_policy_infra" "example" {
name = "%s"
description = "some tunnel policy description"
access {
roles = ["ANY"]
trust_level = "High"
}
}

resource "banyan_service_k8s" "example" {
name = "%s"
description = "realdescription"
access_tier = banyan_accesstier.example.name
domain = "test-k8s.corp.com"
policy = banyan_policy_infra.example.id
backend_dns_override_for_domain = "test-k8s.service"
client_kube_cluster_name = "k8s-cluster"
client_kube_ca_key = "k8scAk3yH3re"
client_banyanproxy_listen_port = "9119"
}
`, rName, rName, rName, rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("banyan_service_k8s.example", "name", rName),
),
},
{
ResourceName: "banyan_service_k8s.example",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
6 changes: 6 additions & 0 deletions banyan/resource_service_rdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ func RdpSchema() map[string]*schema.Schema {
},
Description: "allow admin to add custom rdp settings which app will add in rdp file",
},
"policy_enforcing": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "mode in which policy should be. If this is true policy is in enforcing mode else policy is in Permissive mode",
},
}
}

Expand Down
100 changes: 100 additions & 0 deletions banyan/resource_service_rdp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ resource "banyan_service_rdp" "example" {
backend_domain = "%s-rdp.internal"
backend_port = 3389
rdp_settings = ["devicestoredirect:s:*"]
policy_enforcing = false
}
`, name, name, name)
}
Expand Down Expand Up @@ -243,6 +244,7 @@ resource "banyan_service_rdp" "example_without_rdp" {
domain = "%s-rdp.corp.com"
backend_domain = "%s-rdp.internal"
backend_port = 3389
policy_enforcing = false
}
`, name, name, name)
}
Expand Down Expand Up @@ -361,3 +363,101 @@ func testAccService_infra_rdp_create_without_rdp_settings_json(name string) stri
}
`, name, name, name, name, name)
}

func TestAccRDPService_basic(t *testing.T) {

rName := fmt.Sprintf("tf-acc-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))

resource.Test(t, resource.TestCase{
Providers: testAccProviders,
CheckDestroy: nil,
Steps: []resource.TestStep{
//test case with policy enforce
{
Config: fmt.Sprintf(`
resource "banyan_api_key" "example" {
name = "%s"
description = "realdescription"
scope = "access_tier"
}

resource banyan_accesstier "example" {
name = "%s"
address = "*.example.com"
api_key_id = banyan_api_key.example.id
}

resource "banyan_policy_infra" "example" {
name = "%s"
description = "some tunnel policy description"
access {
roles = ["ANY"]
trust_level = "High"
}
}

resource "banyan_service_rdp" "example" {
name = "%s"
description = "realdescription"
access_tier = banyan_accesstier.example.name
domain = "test-k8s.corp.com"
policy = banyan_policy_infra.example.id
backend_domain = "10.1.34.54"
backend_port = 3389
}
`, rName, rName, rName, rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("banyan_service_rdp.example", "name", rName),
),
},
{
ResourceName: "banyan_service_rdp.example",
ImportState: true,
ImportStateVerify: true,
},
// test case without policy enforcing
{
Config: fmt.Sprintf(`
resource "banyan_api_key" "example" {
name = "%s"
description = "realdescription"
scope = "access_tier"
}

resource banyan_accesstier "example" {
name = "%s"
address = "*.example.com"
api_key_id = banyan_api_key.example.id
}

resource "banyan_policy_infra" "example" {
name = "%s"
description = "some tunnel policy description"
access {
roles = ["ANY"]
trust_level = "High"
}
}

resource "banyan_service_rdp" "example" {
name = "%s"
description = "realdescription"
access_tier = banyan_accesstier.example.name
domain = "test-k8s.corp.com"
policy = banyan_policy_infra.example.id
backend_domain = "10.1.34.54"
backend_port = 3389
}
`, rName, rName, rName, rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("banyan_service_rdp.example", "name", rName),
),
},
{
ResourceName: "banyan_service_rdp.example",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
6 changes: 6 additions & 0 deletions banyan/resource_service_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ func SshSchema() map[string]*schema.Schema {
Optional: true,
Default: false,
},
"policy_enforcing": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "mode in which policy should be. If this is true policy is in enforcing mode else policy is in Permissive mode",
},
"allow_patterns": {
Type: schema.TypeSet,
MaxItems: 1,
Expand Down
Loading