From b8576f9ec33fb0bf636a844976da6ecee3a357fe Mon Sep 17 00:00:00 2001 From: SunithaGudisagar Date: Thu, 12 Oct 2023 19:05:54 +0530 Subject: [PATCH] match_resource_type development --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 19 ++++--- examples/ibm-is-ng/main.tf | 27 +++++++++ .../vpc/data_source_ibm_is_backup_policies.go | 4 +- .../vpc/data_source_ibm_is_backup_policy.go | 8 +-- ..._ibm_is_snapshot_consistency_group_test.go | 30 +++++++--- .../vpc/resource_ibm_is_backup_policy.go | 46 ++++++++++++---- ..._ibm_is_snapshot_consistency_group_test.go | 24 ++++---- ...s_snapshot_consistency_group.html.markdown | 49 +++++++---------- ..._snapshot_consistency_groups.html.markdown | 55 +++++++------------ website/docs/r/is_backup_policy.html.markdown | 4 ++ ...s_snapshot_consistency_group.html.markdown | 46 ++++++++++------ 11 files changed, 186 insertions(+), 126 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index b9f8af31c8..da0ecdf4d3 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-08-08") + options.Version = core.StringPtr("2023-09-01") } service = &VpcV1{ @@ -9856,8 +9856,10 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP } builder.AddHeader("Accept", "application/json") - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("version", fmt.Sprint("2024-01-01")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("future_version", fmt.Sprint("true")) + // builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listBackupPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) } @@ -9932,8 +9934,9 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("version", fmt.Sprint("2024-01-01")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("future_version", fmt.Sprint("true")) _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) if err != nil { @@ -10535,8 +10538,9 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) } - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("version", fmt.Sprint("2024-01-01")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("future_version", fmt.Sprint("true")) request, err := builder.Build() if err != nil { @@ -10598,9 +10602,9 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic } builder.AddHeader("Accept", "application/json") - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("version", fmt.Sprint("2024-01-01")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - + builder.AddQuery("future_version", fmt.Sprint("true")) request, err := builder.Build() if err != nil { return @@ -10666,8 +10670,9 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) } - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("version", fmt.Sprint("2024-01-01")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("future_version", fmt.Sprint("true")) _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) if err != nil { diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index b4ce696697..fd8f19367d 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1385,3 +1385,30 @@ resource "ibm_is_image_deprecate" "example" { resource "ibm_is_image_obsolete" "example" { image = ibm_is_image.image1.id } + + +//snapshot consistency group + +resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { + delete_snapshots_on_delete = true + snapshots { + name = "exmaple-snapshot" + source_volume = ibm_is_instance.instance.volume_attachments[0].volume_id + } + snapshots { + name = "example-snapshot-1" + source_volume = ibm_is_instance.instance.volume_attachments[1].volume_id + } + name = "example-snapshot-consistency-group" +} + +data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { + identifier = ibm_is_snapshot_consistency_group.is_snapshot_consistency_group_instance.id +} +data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { + name = "example-snapshot-consistency-group" +} +data "ibm_is_snapshot_consistency_groups" "is_snapshot_consistency_group_instance" { + depends_on = [ibm_is_snapshot_consistency_group.is_snapshot_consistency_group_instance] + name = "example-snapshot-consistency-group" +} \ No newline at end of file diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policies.go b/ibm/service/vpc/data_source_ibm_is_backup_policies.go index 26994b1bf9..6ea8b20f09 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policies.go @@ -282,8 +282,8 @@ func dataSourceBackupPolicyCollectionBackupPoliciesToMap(backupPoliciesItem vpcv if backupPoliciesItem.LastJobCompletedAt != nil { backupPoliciesMap["last_job_completed_at"] = flex.DateTimeToString(backupPoliciesItem.LastJobCompletedAt) } - if backupPoliciesItem.MatchResourceTypes != nil { - backupPoliciesMap["match_resource_types"] = backupPoliciesItem.MatchResourceTypes + if backupPoliciesItem.MatchResourceType != nil { + backupPoliciesMap["match_resource_types"] = []string{*backupPoliciesItem.MatchResourceType} } if backupPoliciesItem.MatchUserTags != nil { backupPoliciesMap["match_user_tags"] = backupPoliciesItem.MatchUserTags diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy.go b/ibm/service/vpc/data_source_ibm_is_backup_policy.go index 57073eba5a..7368293201 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy.go @@ -246,13 +246,9 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource } } - matchResourceType := make([]string, 0) - if backupPolicy.MatchResourceTypes != nil { - for _, matchResourceTyp := range backupPolicy.MatchResourceTypes { - matchResourceType = append(matchResourceType, matchResourceTyp) - } + if backupPolicy.MatchResourceType != nil { + d.Set("match_resource_types", []string{*backupPolicy.MatchResourceType}) } - d.Set("match_resource_types", matchResourceType) if backupPolicy.IncludedContent != nil { if err = d.Set("included_content", backupPolicy.IncludedContent); err != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go index 277357f8d3..37a2c4c9b0 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group_test.go @@ -5,20 +5,32 @@ package vpc_test import ( "fmt" + "strings" "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" ) func TestAccIBMIsSnapshotConsistencyGroupDataSourceBasic(t *testing.T) { + vpcname := fmt.Sprintf("tf-vpc-%d", acctest.RandIntRange(10, 100)) + name := fmt.Sprintf("tf-instance-%d", acctest.RandIntRange(10, 100)) + subnetname := fmt.Sprintf("tf-subnet-%d", acctest.RandIntRange(10, 100)) + publicKey := strings.TrimSpace(` +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR +`) + sshname := fmt.Sprintf("tf-ssh-%d", acctest.RandIntRange(10, 100)) + deleteSnapshotsOnDelete := "true" + scgname := fmt.Sprintf("tf-snap-cons-grp-name-%d", acctest.RandIntRange(10, 100)) + snapname := fmt.Sprintf("tf-snap-name-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIBMIsSnapshotConsistencyGroupDataSourceConfigBasic(), + Config: testAccCheckIBMIsSnapshotConsistencyGroupDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "id"), resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "created_at"), @@ -30,16 +42,20 @@ func TestAccIBMIsSnapshotConsistencyGroupDataSourceBasic(t *testing.T) { resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "resource_group.#"), resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "resource_type"), resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.name"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.crn"), + resource.TestCheckResourceAttrSet("data.ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshots.0.href"), ), }, }, }) } -func testAccCheckIBMIsSnapshotConsistencyGroupDataSourceConfigBasic() string { - return fmt.Sprintf(` - data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { - identifier = "r134-628982dd-bb79-4f7c-ac64-d1b70b1064e8" - } - `) +func testAccCheckIBMIsSnapshotConsistencyGroupDataSourceConfigBasic(vpcname, subnetname, sshname, publicKey, name, snapname, scgname, deleteSnapshotsOnDelete string) string { + return testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete) + fmt.Sprintf(` + data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { + identifier = ibm_is_snapshot_consistency_group.is_snapshot_consistency_group.id + } +`) } diff --git a/ibm/service/vpc/resource_ibm_is_backup_policy.go b/ibm/service/vpc/resource_ibm_is_backup_policy.go index b2bcd1e4c9..c662dc4dbe 100644 --- a/ibm/service/vpc/resource_ibm_is_backup_policy.go +++ b/ibm/service/vpc/resource_ibm_is_backup_policy.go @@ -27,12 +27,23 @@ func ResourceIBMIsBackupPolicy() *schema.Resource { Schema: map[string]*schema.Schema{ "match_resource_types": &schema.Schema{ - Type: schema.TypeSet, - Optional: true, - Computed: true, - Set: schema.HashString, - Description: "A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy.", - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Optional: true, + Computed: true, + Set: schema.HashString, + Deprecated: "match_resource_types is being deprecated. Use match_resource_type instead", + Description: "A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy.", + ConflictsWith: []string{"match_resource_type"}, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "match_resource_type": { + Type: schema.TypeString, + Optional: true, + Default: "volume", + ForceNew: true, + ConflictsWith: []string{"match_resource_types"}, + ValidateFunc: validate.InvokeValidator("ibm_is_backup_policy", "match_resource_type"), + Description: "A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy.", }, "match_user_tags": &schema.Schema{ Type: schema.TypeSet, @@ -44,6 +55,7 @@ func ResourceIBMIsBackupPolicy() *schema.Resource { "included_content": &schema.Schema{ Type: schema.TypeSet, Optional: true, + Computed: true, Set: schema.HashString, Description: "The included content for backups created using this policy", Elem: &schema.Schema{Type: schema.TypeString, ValidateFunc: validate.InvokeValidator("ibm_is_backup_policy", "included_content")}, @@ -134,7 +146,7 @@ func ResourceIBMIsBackupPolicyValidator() *validate.ResourceValidator { ) validateSchema = append(validateSchema, validate.ValidateSchema{ - Identifier: "match_resource_types", + Identifier: "match_resource_type", ValidateFunctionIdentifier: validate.ValidateRegexpLen, Type: validate.TypeString, Optional: true, @@ -156,8 +168,11 @@ func resourceIBMIsBackupPolicyCreate(context context.Context, d *schema.Resource createBackupPolicyOptions := &vpcv1.CreateBackupPolicyOptions{} backupPolicyPrototype := &vpcv1.BackupPolicyPrototype{} - if _, ok := d.GetOk("match_resource_types"); ok { - backupPolicyPrototype.MatchResourceTypes = flex.ExpandStringList((d.Get("match_resource_types").(*schema.Set)).List()) + if matchResourceType, ok := d.GetOk("match_resource_type"); ok { + backupPolicyPrototype.MatchResourceType = core.StringPtr(matchResourceType.(string)) + } else if matchResourceTypes, ok := d.GetOk("match_resource_types"); ok { + matchResourceTypeList := flex.ExpandStringList((matchResourceTypes.(*schema.Set)).List()) + backupPolicyPrototype.MatchResourceType = core.StringPtr(matchResourceTypeList[0]) } if _, ok := d.GetOk("included_content"); ok { backupPolicyPrototype.IncludedContent = flex.ExpandStringList((d.Get("included_content").(*schema.Set)).List()) @@ -175,7 +190,7 @@ func resourceIBMIsBackupPolicyCreate(context context.Context, d *schema.Resource } backupPolicyPrototype.ResourceGroup = &resourceGroup } - + createBackupPolicyOptions.SetBackupPolicyPrototype(backupPolicyPrototype) backupPolicyIntf, response, err := vpcClient.CreateBackupPolicyWithContext(context, createBackupPolicyOptions) if err != nil { log.Printf("[DEBUG] CreateBackupPolicyWithContext failed %s\n%s", err, response) @@ -209,11 +224,18 @@ func resourceIBMIsBackupPolicyRead(context context.Context, d *schema.ResourceDa } backupPolicy := backupPolicyIntf.(*vpcv1.BackupPolicy) - if backupPolicy.MatchResourceTypes != nil { - if err = d.Set("match_resource_types", backupPolicy.MatchResourceTypes); err != nil { + if backupPolicy.MatchResourceType != nil { + matchResourceTypes := *backupPolicy.MatchResourceType + matchResourceTypesList := []string{matchResourceTypes} + if err = d.Set("match_resource_types", matchResourceTypesList); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_types: %s", err)) } } + if backupPolicy.MatchResourceType != nil { + if err = d.Set("match_resource_type", backupPolicy.MatchResourceType); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_type: %s", err)) + } + } if backupPolicy.IncludedContent != nil { if err = d.Set("included_content", backupPolicy.IncludedContent); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting included_content: %s", err)) diff --git a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go index b0d17d70cc..5637ad4799 100644 --- a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go +++ b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group_test.go @@ -30,7 +30,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE scgname := fmt.Sprintf("tf-snap-cons-grp-name-%d", acctest.RandIntRange(10, 100)) deleteSnapshotsOnDeleteUpdate := "false" snapname := fmt.Sprintf("tf-snap-name-%d", acctest.RandIntRange(10, 100)) - scgnameUpdate := fmt.Sprintf("tf-snap-cons-grp-name-%d", acctest.RandIntRange(10, 100)) + scgnameUpdate := fmt.Sprintf("tf-snap-cons-grp-name-update-%d", acctest.RandIntRange(10, 100)) resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, @@ -42,7 +42,16 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE Check: resource.ComposeAggregateTestCheckFunc( testAccCheckIBMIsSnapshotConsistencyGroupExists("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", conf), resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "delete_snapshots_on_delete", deleteSnapshotsOnDelete), - resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name", name), + resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name", scgname), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "id"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "href"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "lifecycle_state"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshot_reference.0.id"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshot_reference.0.crn"), + resource.TestCheckResourceAttrSet("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "snapshot_reference.0.name"), ), }, resource.TestStep{ @@ -52,16 +61,11 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE resource.TestCheckResourceAttr("ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", "name", scgnameUpdate), ), }, - resource.TestStep{ - ResourceName: "ibm_is_snapshot_consistency_group.is_snapshot_consistency_group", - ImportState: true, - ImportStateVerify: true, - }, }, }) } -func testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, scgname, snapname, deleteSnapshotsOnDelete string) string { +func testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshname, publicKey, name, snapname, scgname, deleteSnapshotsOnDelete string) string { return fmt.Sprintf(` resource "ibm_is_vpc" "testacc_vpc" { @@ -96,7 +100,7 @@ func testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshnam } } - resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { + resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { delete_snapshots_on_delete = "%s" snapshots { name = "%s" @@ -104,7 +108,7 @@ func testAccCheckIBMIsSnapshotConsistencyGroupConfig(vpcname, subnetname, sshnam } name = "%s" } - `, vpcname, subnetname, acc.ISZoneName, sshname, publicKey, name, "r134-f47cc24c-e020-4db5-ad96-1e5be8b5853b", acc.InstanceProfileName, acc.ISZoneName, deleteSnapshotsOnDelete, snapname, scgname) + `, vpcname, subnetname, acc.ISZoneName, sshname, publicKey, name, "r134-f47cc24c-e020-4db5-ad96-1e5be8b5853b", acc.InstanceProfileName, acc.ISZoneName, deleteSnapshotsOnDelete, scgname, snapname) } func testAccCheckIBMIsSnapshotConsistencyGroupExists(n string, obj vpcv1.SnapshotConsistencyGroup) resource.TestCheckFunc { diff --git a/website/docs/d/is_snapshot_consistency_group.html.markdown b/website/docs/d/is_snapshot_consistency_group.html.markdown index 59691d5b90..43110ba9f8 100644 --- a/website/docs/d/is_snapshot_consistency_group.html.markdown +++ b/website/docs/d/is_snapshot_consistency_group.html.markdown @@ -25,7 +25,7 @@ provider "ibm" { ```terraform data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { - id = "id" + identifier = ibm_is_snapshot_consistency_group.is_snapshot_consistency_group.id } ``` @@ -33,7 +33,8 @@ data "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { You can specify the following arguments for this data source. -- `id` - (Required, Forces new resource, String) The snapshot consistency group identifier. +- `identifier` - (Optional, String) The snapshot consistency group identifier, `name` and `identifier` are mutually exclusive. +- `name` - (Optional, String) The name of the snapshot consistency group,`name` and `identifier` are mutually exclusive. ## Attribute Reference @@ -41,19 +42,18 @@ After your data source is created, you can read values from the following attrib - `id` - The unique identifier of the SnapshotConsistencyGroup. - `backup_policy_plan` - (List) If present, the backup policy plan which created this snapshot consistency group. - Nested schema for **backup_policy_plan**: + + Nested schema for `backup_policy_plan`: - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: + Nested schema for `deleted`: - `more_info` - (String) Link to documentation about deleted resources. - `href` - (String) The URL for this backup policy plan. - `id` - (String) The unique identifier for this backup policy plan. - `name` - (String) The name for this backup policy plan. The name is unique across all plans in the backup policy. - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. - Nested schema for **remote**: - - `region` - (List) If present, this property indicates that the referenced resource is remote to thisregion, and identifies the native region. - Nested schema for **region**: - - `href` - (String) The URL for this region. - - `name` - (String) The globally unique name for this region. + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. - `resource_type` - (String) The resource type. - `created_at` - (String) The date and time that this snapshot consistency group was created. @@ -63,7 +63,8 @@ After your data source is created, you can read values from the following attrib - `lifecycle_state` - (String) The lifecycle state of this snapshot consistency group. - `name` - (String) The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region. - `resource_group` - (List) The resource group for this snapshot consistency group. - Nested schema for **resource_group**: + + Nested schema for `resource_group`: - `href` - (String) The URL for this resource group. - `id` - (String) The unique identifier for this resource group. - `name` - (String) The name for this resource group. @@ -71,31 +72,19 @@ After your data source is created, you can read values from the following attrib - `resource_type` - (String) The resource type. - `service_tags` - (List) The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group. - `snapshots` - (List) The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Nested schema for **snapshots**: + Nested schema for `snapshots`: - `crn` - (String) The CRN of this snapshot. - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: - - `more_info` - (String) Link to documentation about deleted resources. + + Nested schema for `deleted`: + - `more_info` - (String) Link to documentation about deleted resources. - `href` - (String) The URL for this snapshot. - `id` - (String) The unique identifier for this snapshot. - `name` - (String) The name for this snapshot. The name is unique across all snapshots in the region. - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. - Nested schema for **remote**: - - `region` - (List) If present, this property indicates that the referenced resource is remote to thisregion, and identifies the native region. - Nested schema for **region**: - - `href` - (String) The URL for this region. - - `name` - (String) The globally unique name for this region. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. - `resource_type` - (String) The resource type. -- `snapshot_consistency_group` - (List) The snapshot consistency group which created this snapshot. - - Nested scheme for `snapshot_consistency_group`: - - `crn` - (String) The CRN of this snapshot consistency group. - - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - - Nested scheme for `deleted`: - - `more_info` - (String) Link to documentation about deleted resources. - - `href` - (String) The URL for the snapshot consistency group. - - `id` - (String) The unique identifier for the snapshot consistency group. - - `name` - (String) TThe name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region. - - `resource_type` - (String) The resource type. diff --git a/website/docs/d/is_snapshot_consistency_groups.html.markdown b/website/docs/d/is_snapshot_consistency_groups.html.markdown index 9b8fef2f26..447cb1c4b1 100644 --- a/website/docs/d/is_snapshot_consistency_groups.html.markdown +++ b/website/docs/d/is_snapshot_consistency_groups.html.markdown @@ -25,7 +25,7 @@ provider "ibm" { ```terraform data "ibm_is_snapshot_consistency_groups" "is_snapshot_consistency_groups" { - sort = "name" + name = "example-snapshot-consistency-group" } ``` @@ -33,10 +33,9 @@ data "ibm_is_snapshot_consistency_groups" "is_snapshot_consistency_groups" { You can specify the following arguments for this data source. -- `backup_policy_plan_id` - (Optional, String) Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified identifier. +- `backup_policy_plan` - (Optional, String) Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified identifier. - `name` - (Optional, String) Filters the collection to resources with a `name` property matching the exact specified name. -- `resource_group_id` - (Optional, String) Filters the collection to resources with a `resource_group.id` property matching the specified identifier. -- `sort` - (Optional, String) Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property in descending order, and the value `name` sorts it by the `name` property in ascending order. +- `resource_group` - (Optional, String) Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ## Attribute Reference @@ -44,21 +43,22 @@ After your data source is created, you can read values from the following attrib - `id` - The unique identifier of the SnapshotConsistencyGroupCollection. - `snapshot_consistency_groups` - (List) Collection of snapshot consistency groups. - Nested schema for **snapshot_consistency_groups**: + + Nested schema for `snapshot_consistency_groups`: - `backup_policy_plan` - (List) If present, the backup policy plan which created this snapshot consistency group. - Nested schema for **backup_policy_plan**: + Nested schema for `backup_policy_plan`: - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: + + Nested schema for `deleted`: - `more_info` - (String) Link to documentation about deleted resources. - `href` - (String) The URL for this backup policy plan. - `id` - (String) The unique identifier for this backup policy plan. - `name` - (String) The name for this backup policy plan. The name is unique across all plans in the backup policy. - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. - Nested schema for **remote**: - - `region` - (List) If present, this property indicates that the referenced resource is remote to thisregion, and identifies the native region. - Nested schema for **region**: - - `href` - (String) The URL for this region. - - `name` - (String) The globally unique name for this region. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. - `resource_type` - (String) The resource type. - `created_at` - (String) The date and time that this snapshot consistency group was created. - `crn` - (String) The CRN of this snapshot consistency group. @@ -67,36 +67,23 @@ After your data source is created, you can read values from the following attrib - `id` - (String) The unique identifier for this snapshot consistency group. - `lifecycle_state` - (String) The lifecycle state of this snapshot consistency group. - `name` - (String) The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region. - - `resource_group` - (List) The resource group for this snapshot consistency group. - Nested schema for **resource_group**: - - `href` - (String) The URL for this resource group. - - `id` - (String) The unique identifier for this resource group. - - `name` - (String) The name for this resource group. + - `resource_group` - (List) The resource group identifier for this snapshot consistency group. - `resource_type` - (String) The resource type. - `service_tags` - (List) The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group. - `snapshots` - (List) The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Nested schema for **snapshots**: + + Nested schema for `snapshots`: - `crn` - (String) The CRN of this snapshot. - `deleted` - (List) If present, this property indicates the referenced resource has been deleted, and providessome supplementary information. - Nested schema for **deleted**: + + Nested schema for `deleted`: - `more_info` - (String) Link to documentation about deleted resources. - `href` - (String) The URL for this snapshot. - `id` - (String) The unique identifier for this snapshot. - `name` - (String) The name for this snapshot. The name is unique across all snapshots in the region. - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. - Nested schema for **remote**: - - `region` - (List) If present, this property indicates that the referenced resource is remote to thisregion, and identifies the native region. - Nested schema for **region**: - - `href` - (String) The URL for this region. - - `name` - (String) The globally unique name for this region. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. - `resource_type` - (String) The resource type. - - `snapshot_consistency_group` - (List) The snapshot consistency group which created this snapshot. - Nested scheme for `snapshot_consistency_group`: - - `crn` - (String) The CRN of this snapshot consistency group. - - `deleted` - (List) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - Nested scheme for `deleted`: - - `more_info` - (String) Link to documentation about deleted resources. - - `href` - (String) The URL for the snapshot consistency group. - - `id` - (String) The unique identifier for the snapshot consistency group. - - `name` - (String) TThe name for the snapshot consistency group. The name is unique across all snapshot consistency groups in the region. - - `resource_type` - (String) The resource type. diff --git a/website/docs/r/is_backup_policy.html.markdown b/website/docs/r/is_backup_policy.html.markdown index a6b1a5d179..82ad2aa02b 100644 --- a/website/docs/r/is_backup_policy.html.markdown +++ b/website/docs/r/is_backup_policy.html.markdown @@ -36,6 +36,10 @@ resource "ibm_is_backup_policy" "example" { Review the argument reference that you can specify for your resource. - `match_resource_types` - (Optional, List) A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will be subject to the backup policy. The default value is `["volume"]`. + +~> **Note** + `match_resource_types` is deprecated. Please use `match_resource_type` instead. +- `match_resource_type` - (Optional, String) The resource type this backup policy will apply to. Resources that have both a matching type and a matching user tag will be subject to the backup policy. The default value is `["volume"]`. Allowed values are `volume`,`instance`. - `match_user_tags` - (Required, List) The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will be subject to the backup policy. - `name` - (Required, String) The user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. - `resource_group` - (Optional, List) The resource group id, to use. If unspecified, the account's [default resource group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. diff --git a/website/docs/r/is_snapshot_consistency_group.html.markdown b/website/docs/r/is_snapshot_consistency_group.html.markdown index bed251c382..18f944945a 100644 --- a/website/docs/r/is_snapshot_consistency_group.html.markdown +++ b/website/docs/r/is_snapshot_consistency_group.html.markdown @@ -24,11 +24,13 @@ provider "ibm" { ## Example Usage ```terraform -resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_instance" { - name = "my-snapshot-consistency-group" - resource_group = +resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group" { + delete_snapshots_on_delete = true snapshots { + name = "example-snapshot" + source_volume = ibm_is_instance.testacc_instance.volume_attachments[0].volume_id } + name = "example-snapshot-consistency-group" } ``` @@ -36,14 +38,23 @@ resource "ibm_is_snapshot_consistency_group" "is_snapshot_consistency_group_inst You can specify the following arguments for this resource. +- `access_tags` - (Optional, List of Strings) A list of access management tags to attach to the bare metal server. + + ~> **Note:** + **•** You can attach only those access tags that already exists.
+ **•** For more information, about creating access tags, see [working with tags](https://cloud.ibm.com/docs/account?topic=account-tag&interface=ui#create-access-console).
+ **•** You must have the access listed in the [Granting users access to tag resources](https://cloud.ibm.com/docs/account?topic=account-access) for `access_tags`
+ **•** `access_tags` must be in the format `key:value`. - `delete_snapshots_on_delete` - (Optional, Boolean) Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. - `name` - (Optional, String) The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the region. - `resource_group` - (Optional, Forces new resource, String) The resource group ID where the snapshot consistency group is to be created. - `snapshots` - (Required, List) The member snapshots that are data-consistent with respect to captured time. (may be[deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Nested schema for **snapshots**: - - `name` - (Optional, String) The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name will be a hyphenated list of randomly-selected words. - - `source_volume` - (Required, Forces new resource, String) The unique identifier for the volume for which snapshot is to be created. - - `tags`- (Optional, Array of Strings) A list of user tags that you want to add to your snapshot. (https://cloud.ibm.com/apidocs/tagging#types-of-tags) + + Nested schema for `snapshots`: + - `name` - (Optional, String) The name for this snapshot. + - `source_volume` - (Required, Forces new resource, String) The unique identifier for the volume for which snapshot is to be created. + - `tags`- (Optional, Array of Strings) A list of user tags that you want to add to your snapshot. (https://cloud.ibm.com/apidocs/tagging#types-of-tags) +- `tags`- (Optional, Array of Strings) A list of user tags that you want to add to your snapshot. (https://cloud.ibm.com/apidocs/tagging#types-of-tags) ## Attribute Reference @@ -62,12 +73,12 @@ After your resource is created, you can read values from the listed arguments an - `id` - (String) The unique identifier for this backup policy plan. - `name` - (String) The unique user defined name for this backup policy plan. If unspecified, the name will be a hyphenated list of randomly selected words. - `resource_type` - (String) The type of resource referenced. - - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. - Nested schema for **remote**: - - `region` - (List) If present, this property indicates that the referenced resource is remote to thisregion, and identifies the native region. - Nested schema for **region**: - - `href` - (String) The URL for this region. - - `name` - (String) The globally unique name for this region. + - `remote` - (List) If present, this property indicates that the resource associated with this referenceis remote and therefore may not be directly retrievable. + + Nested schema for `remote`: + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. + - `created_at` - (String) The date and time that this snapshot consistency group was created. - `crn` - (String) The CRN of this snapshot consistency group. - `href` - (String) The URL for this snapshot consistency group. @@ -84,12 +95,11 @@ After your resource is created, you can read values from the listed arguments an - `href` - (String) The URL for the source snapshot. - `id` - (String) The unique identifier for the source snapshot. - `name` - (String) The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region. - - `remote` - (List) If present, this property indicates the referenced resource is remote to this region,and identifies the native region. + - `remote` - (List) If present, this property indicates the referenced resource is remote to this region,and identifies the native region + Nested scheme for `remote`: - - `region` - (Optional, List) If present, this property indicates that the referenced resource is remote to thisregion, and identifies the native region. - Nested scheme for `region`: - - `href` - (String) The URL for this region. - - `name` - (String) The globally unique name for this region. + - `href` - (String) The URL for this region. + - `name` - (String) The globally unique name for this region. - `resource_type` - (String) The resource type. - `service_tags` - (List) The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags)[`is.instance:` prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs) associated with this snapshot consistency group.