Skip to content

Commit

Permalink
Added manage_dns, manage_registry and manage_dataplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
cciopa-ionos committed Feb 5, 2025
1 parent 81f090d commit c864cfe
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 21 deletions.
3 changes: 3 additions & 0 deletions docs/data-sources/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ The following attributes are returned by the datasource:
* `create_flow_log` - The group will be allowed to create flow log.
* `access_and_manage_monitoring` The group will be allowed to access and manage monitoring.
* `access_and_manage_certificates` - The group will be allowed to access and manage certificates.
* `access_and_manage_dns` - The group will be allowed to access and manage dns records.
* `manage_registry` - The group will be allowed to access container registry related functionality.
* `manage_dataplatform` - The group will be allowed to access and manage the Data Platform.
* `access_and_manage_logging` - The group will be allowed to access and manage logging.
* `access_and_manage_cdn` - The group will be allowed to access and manage cdn.
* `access_and_manage_vpn` - The group will be allowed to access and manage vpn.
Expand Down
3 changes: 3 additions & 0 deletions docs/resources/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ resource "random_password" "user2_password" {
* `create_flow_log` - (Optional) [Boolean] The group will be allowed to create flow log.
* `access_and_manage_monitoring` - (Optional) [Boolean] The group will be allowed to access and manage monitoring.
* `access_and_manage_certificates` - (Optional) [Boolean] The group will be allowed to access and manage certificates.
* `access_and_manage_dns` - (Optional) [Boolean] The group will be allowed to access and manage dns records.
* `manage_registry` - (Optional) [Boolean] The group will be allowed to access container registry related functionality.
* `manage_dataplatform` - (Optional) [Boolean] The group will be allowed to access and manage the Data Platform.
* `access_and_manage_logging` - (Optional) [Boolean] The group will be allowed to access and manage logging.
* `access_and_manage_cdn` - (Optional) [Boolean] The group will be allowed to access and manage cdn.
* `access_and_manage_vpn` - (Optional) [Boolean] The group will be allowed to access and manage vpn.
Expand Down
29 changes: 22 additions & 7 deletions ionoscloud/data_source_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ func dataSourceGroup() *schema.Resource {
Description: "Create Flow Logs privilege.",
Computed: true,
},
"create_network_security_groups": {
Type: schema.TypeBool,
Description: "Privilege for a group to create NetworkSecurityGroups.",
Computed: true,
},
"access_and_manage_monitoring": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage monitoring related functionality " +
Expand All @@ -83,6 +78,26 @@ func dataSourceGroup() *schema.Resource {
Description: "Privilege for a group to access and manage certificates.",
Computed: true,
},
"manage_dbaas": {
Type: schema.TypeBool,
Description: "Privilege for a group to manage DBaaS related functionality",
Computed: true,
},
"access_and_manage_dns": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage dns records.",
Computed: true,
},
"manage_registry": {
Type: schema.TypeBool,
Description: "Privilege for group accessing container registry related functionality.",
Computed: true,
},
"manage_dataplatform": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage the Data Platform.",
Computed: true,
},
"access_and_manage_logging": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage Logging.",
Expand Down Expand Up @@ -123,9 +138,9 @@ func dataSourceGroup() *schema.Resource {
Description: "Privilege for a group to access and manage IamResources.",
Computed: true,
},
"manage_dbaas": {
"create_network_security_groups": {
Type: schema.TypeBool,
Description: "Privilege for a group to manage DBaaS related functionality",
Description: "Privilege for a group to create NetworkSecurityGroups.",
Computed: true,
},
"users": {
Expand Down
60 changes: 53 additions & 7 deletions ionoscloud/resource_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ func resourceGroup() *schema.Resource {
Description: "Create Flow Logs privilege.",
Optional: true,
},
"create_network_security_groups": {
Type: schema.TypeBool,
Description: "Create Network Security groups.",
Optional: true,
},
"access_and_manage_monitoring": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage monitoring related functionality " +
Expand All @@ -91,6 +86,26 @@ func resourceGroup() *schema.Resource {
Description: "Privilege for a group to access and manage certificates.",
Optional: true,
},
"manage_dbaas": {
Type: schema.TypeBool,
Description: "Privilege for a group to manage DBaaS related functionality",
Optional: true,
},
"access_and_manage_dns": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage dns records.",
Optional: true,
},
"manage_registry": {
Type: schema.TypeBool,
Description: "Privilege for group accessing container registry related functionality.",
Optional: true,
},
"manage_dataplatform": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage the Data Platform.",
Optional: true,
},
"access_and_manage_logging": {
Type: schema.TypeBool,
Description: "Privilege for a group to access and manage logging.",
Expand Down Expand Up @@ -131,9 +146,9 @@ func resourceGroup() *schema.Resource {
Description: "Privilege for a group to access and manage IamResources.",
Optional: true,
},
"manage_dbaas": {
"create_network_security_groups": {
Type: schema.TypeBool,
Description: "Privilege for a group to manage DBaaS related functionality",
Description: "Create Network Security groups.",
Optional: true,
},
"user_id": {
Expand Down Expand Up @@ -265,6 +280,12 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter
manageDbaas := d.Get("manage_dbaas").(bool)
request.Properties.AccessAndManageCertificates = &tempAccessAndManageCertificates
request.Properties.ManageDBaaS = &manageDbaas
accessAndManageDns := d.Get("access_and_manage_dns").(bool)

Check failure on line 283 in ionoscloud/resource_group.go

View workflow job for this annotation

GitHub Actions / lint

var `accessAndManageDns` should be `accessAndManageDNS` (golint)
request.Properties.AccessAndManageDns = &accessAndManageDns
manageRegistry := d.Get("manage_registry").(bool)
request.Properties.ManageRegistry = &manageRegistry
manageDataplatform := d.Get("manage_dataplatform").(bool)
request.Properties.ManageDataplatform = &manageDataplatform
tempAccessAndManageLogging := d.Get("access_and_manage_logging").(bool)
request.Properties.AccessAndManageLogging = &tempAccessAndManageLogging
tempAccessAndManageCdn := d.Get("access_and_manage_cdn").(bool)
Expand Down Expand Up @@ -362,6 +383,9 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter
tempCreateNetworkSecurityGroups := d.Get("create_network_security_groups").(bool)
tempAccessAndManageMonitoring := d.Get("access_and_manage_monitoring").(bool)
tempAccessAndManageCertificates := d.Get("access_and_manage_certificates").(bool)
tempAccessAndManageDns := d.Get("access_and_manage_dns").(bool)

Check failure on line 386 in ionoscloud/resource_group.go

View workflow job for this annotation

GitHub Actions / lint

var `tempAccessAndManageDns` should be `tempAccessAndManageDNS` (golint)
tempManageRegistry := d.Get("manage_registry").(bool)
tempManageDataplatform := d.Get("manage_dataplatform").(bool)
tempAccessAndManageLogging := d.Get("access_and_manage_logging").(bool)
tempAccessAndManageCdn := d.Get("access_and_manage_cdn").(bool)
tempAccessAndManageVpn := d.Get("access_and_manage_vpn").(bool)
Expand Down Expand Up @@ -390,6 +414,9 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter
AccessAndManageCertificates: &tempAccessAndManageCertificates,
ManageDBaaS: &tempManageDBaaS,
AccessAndManageLogging: &tempAccessAndManageLogging,
AccessAndManageDns: &tempAccessAndManageDns,
ManageRegistry: &tempManageRegistry,
ManageDataplatform: &tempManageDataplatform,
AccessAndManageCdn: &tempAccessAndManageCdn,
AccessAndManageVpn: &tempAccessAndManageVpn,
AccessAndManageApiGateway: &tempAccessAndManageApiGateway,
Expand Down Expand Up @@ -616,6 +643,25 @@ func setGroupData(ctx context.Context, client *ionoscloud.APIClient, d *schema.R
}
}

if group.Properties.AccessAndManageDns != nil {
err := d.Set("access_and_manage_dns", *group.Properties.AccessAndManageDns)
if err != nil {
return fmt.Errorf("error while setting access_and_manage_dns property for group %s: %w", d.Id(), err)
}
}
if group.Properties.ManageRegistry != nil {
err := d.Set("manage_registry", *group.Properties.ManageRegistry)
if err != nil {
return fmt.Errorf("error while setting manage_registry property for group %s: %w", d.Id(), err)
}
}
if group.Properties.ManageDataplatform != nil {
err := d.Set("manage_dataplatform", *group.Properties.ManageDataplatform)
if err != nil {
return fmt.Errorf("error while setting manage_dataplatform property for group %s: %w", d.Id(), err)
}
}

if group.Properties.AccessAndManageLogging != nil {
err := d.Set("access_and_manage_logging", *group.Properties.AccessAndManageLogging)
if err != nil {
Expand Down
30 changes: 23 additions & 7 deletions ionoscloud/resource_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ func TestAccGroupBasic(t *testing.T) {
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "create_flow_log", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_monitoring", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_certificates", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_dns", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "manage_registry", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "manage_dataplatform", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_logging", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_cdn", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_vpn", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_api_gateway", "true"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_kaas", "true"),
Expand All @@ -70,8 +72,10 @@ func TestAccGroupBasic(t *testing.T) {
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "create_backup_unit", constant.GroupResource+"."+constant.GroupTestResource, "create_backup_unit"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "create_internet_access", constant.GroupResource+"."+constant.GroupTestResource, "create_internet_access"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "create_k8s_cluster", constant.GroupResource+"."+constant.GroupTestResource, "create_k8s_cluster"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "access_and_manage_dns", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_dns"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "manage_registry", constant.GroupResource+"."+constant.GroupTestResource, "manage_registry"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "manage_dataplatform", constant.GroupResource+"."+constant.GroupTestResource, "manage_dataplatform"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "access_and_manage_logging", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_logging"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "access_and_manage_cdn", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_cdn"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "access_and_manage_vpn", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_vpn"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "access_and_manage_api_gateway", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_api_gateway"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceById, "access_and_manage_kaas", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_kaas"),
Expand Down Expand Up @@ -100,8 +104,10 @@ func TestAccGroupBasic(t *testing.T) {
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "create_flow_log", constant.GroupResource+"."+constant.GroupTestResource, "create_flow_log"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_monitoring", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_monitoring"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_certificates", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_certificates"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_dns", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_dns"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "manage_registry", constant.GroupResource+"."+constant.GroupTestResource, "manage_registry"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "manage_dataplatform", constant.GroupResource+"."+constant.GroupTestResource, "manage_dataplatform"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_logging", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_logging"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_cdn", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_cdn"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_vpn", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_vpn"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_api_gateway", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_api_gateway"),
resource.TestCheckResourceAttrPair(constant.DataSource+"."+constant.GroupResource+"."+constant.GroupDataSourceByName, "access_and_manage_kaas", constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_kaas"),
Expand Down Expand Up @@ -138,8 +144,10 @@ func TestAccGroupBasic(t *testing.T) {
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "create_flow_log", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_monitoring", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_certificates", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_dns", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "manage_registry", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "manage_dataplatform", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_logging", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_cdn", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_vpn", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_api_gateway", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_kaas", "false"),
Expand Down Expand Up @@ -168,8 +176,10 @@ func TestAccGroupBasic(t *testing.T) {
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "create_flow_log", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_monitoring", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_certificates", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_dns", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "manage_registry", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "manage_dataplatform", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_logging", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_cdn", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_vpn", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_api_gateway", "false"),
resource.TestCheckResourceAttr(constant.GroupResource+"."+constant.GroupTestResource, "access_and_manage_kaas", "false"),
Expand Down Expand Up @@ -303,14 +313,17 @@ resource ` + constant.GroupResource + ` ` + constant.GroupTestResource + ` {
create_flow_log = true
access_and_manage_monitoring = true
access_and_manage_certificates = true
access_and_manage_dns = true
manage_registry = true
manage_dataplatform = true
access_and_manage_logging = true
access_and_manage_cdn = true
access_and_manage_vpn = true
access_and_manage_api_gateway = true
access_and_manage_kaas = true
access_and_manage_network_file_storage = true
access_and_manage_ai_model_hub = true
create_network_security_groups = true
access_and_manage_iam_resources = true
manage_dbaas = true
Expand Down Expand Up @@ -392,14 +405,17 @@ resource ` + constant.GroupResource + ` "test_user_id" {
create_flow_log = false
access_and_manage_monitoring = false
access_and_manage_certificates = false
access_and_manage_dns = false
manage_registry = false
manage_dataplatform = false
access_and_manage_logging = false
access_and_manage_cdn = false
access_and_manage_vpn = false
access_and_manage_api_gateway = false
access_and_manage_kaas = false
access_and_manage_network_file_storage = false
access_and_manage_ai_model_hub = false
create_network_security_groups = false
access_and_manage_iam_resources = false
manage_dbaas = false
user_id = ` + constant.UserResource + `.` + constant.UserTestResource + `3.id
}
Expand Down

0 comments on commit c864cfe

Please sign in to comment.