Skip to content

Commit

Permalink
Merge branch 'master' of github.com:powervs-ibm/terraform-provider-ib…
Browse files Browse the repository at this point in the history
…m into network-port-attach
  • Loading branch information
ismirlia committed Nov 20, 2024
2 parents 2e512fc + 7f0333b commit 010a22f
Show file tree
Hide file tree
Showing 26 changed files with 649 additions and 624 deletions.
8 changes: 8 additions & 0 deletions ibm/service/database/resource_ibm_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,14 @@ func resourceIBMDatabaseInstanceRead(context context.Context, d *schema.Resource
if endpoint, ok := instance.Parameters["service-endpoints"]; ok {
d.Set("service_endpoints", endpoint)
}

if encryptionInstance, ok := instance.Parameters["disk_encryption_instance_crn"]; ok {
d.Set("key_protect_instance", encryptionInstance)
}

if encryptionKey, ok := instance.Parameters["disk_encryption_key_crn"]; ok {
d.Set("key_protect_key", encryptionKey)
}
}

d.Set(flex.ResourceName, *instance.Name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func TestAccIBMDatabaseInstanceElasticsearchPlatinumImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes", "plan_validation"},
"wait_time_minutes", "plan_validation", "deletion_protection"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func TestAccIBMDatabaseInstanceElasticsearchImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/database/resource_ibm_database_etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestAccIBMDatabaseInstanceEtcdImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestAccIBMDatabaseInstancePostgresImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestAccIBMDatabaseInstanceRabbitmqImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/database/resource_ibm_database_redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestAccIBMDatabaseInstanceRedisImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,17 @@ func resourceIBMIAMAccessGroupTemplateCreate(context context.Context, d *schema.
}
version, _ := strconv.Atoi(*templateResponse.Version)

if d.Get("committed").(bool) {
commitTemplateOptions := &iamaccessgroupsv2.CommitTemplateOptions{}
commitTemplateOptions.SetTemplateID(*templateResponse.ID)
commitTemplateOptions.SetVersionNum(*templateResponse.Version)
commitTemplateOptions.SetIfMatch(response.Headers.Get("ETag"))
response, err = iamAccessGroupsClient.CommitTemplateWithContext(context, commitTemplateOptions)
if err != nil {
log.Printf("[DEBUG] CommitTemplateWithContext failed %s\n%s", err, response)
return diag.FromErr(fmt.Errorf("CommitTemplateWithContext failed %s\n%s", err, response))
}
}
d.SetId(fmt.Sprintf("%s/%d", *templateResponse.ID, version))

return resourceIBMIAMAccessGroupTemplateVersionRead(context, d, meta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func TestAccIBMIAMAccessGroupTemplateBasic(t *testing.T) {
testAccCheckIBMIAMAccessGroupTemplateVersionExists("ibm_iam_access_group_template.template", conf),
resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "name", name),
resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "group.0.name", agName),
resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "committed", "true"),
),
},
},
Expand Down Expand Up @@ -106,6 +107,7 @@ func testAccCheckIBMIAMAccessGroupTemplateConfigBasic(name string, agName string
group {
name = "%s"
}
committed = true
}
`, name, agName)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,18 @@ func resourceIBMIAMAccessGroupTemplateVersionCreate(context context.Context, d *
return diag.FromErr(fmt.Errorf("CreateTemplateVersionWithContext failed %s\n%s", err, response))
}

if d.Get("committed").(bool) {
commitTemplateOptions := &iamaccessgroupsv2.CommitTemplateOptions{}
commitTemplateOptions.SetTemplateID(*templateVersionResponse.ID)
commitTemplateOptions.SetVersionNum(*templateVersionResponse.Version)
commitTemplateOptions.SetIfMatch(response.Headers.Get("ETag"))
response, err = iamAccessGroupsClient.CommitTemplateWithContext(context, commitTemplateOptions)
if err != nil {
log.Printf("[DEBUG] CommitTemplateWithContext failed %s\n%s", err, response)
return diag.FromErr(fmt.Errorf("CommitTemplateWithContext failed %s\n%s", err, response))
}
}

d.SetId(fmt.Sprintf("%s/%s", *templateVersionResponse.ID, *templateVersionResponse.Version))

return resourceIBMIAMAccessGroupTemplateVersionRead(context, d, meta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccIBMIAMAccessGroupTemplateVersion(t *testing.T) {
resource.TestCheckResourceAttr("ibm_iam_access_group_template_version.template", "group.0.name", versionAGName),
resource.TestCheckResourceAttr("ibm_iam_access_group_template_version.template", "name", name),
resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "name", name),
resource.TestCheckResourceAttr("ibm_iam_access_group_template_version.template", "committed", "true"),
),
},
},
Expand All @@ -52,7 +53,7 @@ func TestAccIBMIAMAccessGroupTemplateVersionUpdateWithCommit(t *testing.T) {
CheckDestroy: testAccCheckIBMIAMAccessGroupTemplateVersionDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasic(name, agName, versionAGName),
Config: testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasicWithoutCommit(name, agName, versionAGName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckIBMIAMAccessGroupTemplateVersionExists("ibm_iam_access_group_template_version.template", conf),
resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "group.0.name", agName),
Expand Down Expand Up @@ -87,6 +88,34 @@ func testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasic(name string, agName
}
}
resource "ibm_iam_access_group_template_version" "template" {
template_id = ibm_iam_access_group_template.template.template_id
name = ibm_iam_access_group_template.template.name
description = "Testing4"
group {
name = "%s"
assertions {
action_controls {
add = false
remove = true
}
}
}
committed = true
}
`, name, agName, versionAGName)
}

func testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasicWithoutCommit(name string, agName string, versionAGName string) string {
return fmt.Sprintf(`
resource "ibm_iam_access_group_template" "template" {
name = "%s"
description = "Test Terraform Description"
group {
name = "%s"
}
}
resource "ibm_iam_access_group_template_version" "template" {
template_id = ibm_iam_access_group_template.template.template_id
name = ibm_iam_access_group_template.template.name
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/power/data_source_ibm_pi_sap_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func dataSourceIBMPISAPProfileRead(ctx context.Context, d *schema.ResourceData,
d.Set(Attr_SAPS, sapProfile.Saps)
d.Set(Attr_SupportedSystems, sapProfile.SupportedSystems)
d.Set(Attr_Type, *sapProfile.Type)
d.Set(Attr_WorkloadType, *&sapProfile.WorkloadTypes)
d.Set(Attr_WorkloadType, sapProfile.WorkloadTypes)

return nil
}
2 changes: 1 addition & 1 deletion ibm/service/power/data_source_ibm_pi_sap_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func dataSourceIBMPISAPProfilesRead(ctx context.Context, d *schema.ResourceData,
Attr_SAPS: sapProfile.Saps,
Attr_SupportedSystems: sapProfile.SupportedSystems,
Attr_Type: *sapProfile.Type,
Attr_WorkloadType: *&sapProfile.WorkloadTypes,
Attr_WorkloadType: sapProfile.WorkloadTypes,
}
result = append(result, profile)
}
Expand Down
Loading

0 comments on commit 010a22f

Please sign in to comment.