tencentcloudstack / terraform-provider-tencentcloud

Terraform Tencent Cloud Provider
https://www.terraform.io/docs/providers/tencentcloud/
Mozilla Public License 2.0
188 stars 132 forks source link

使用 tencentcloud_security_groups 数据源资源获取的安全组id错误 #2540

Open wokwong opened 6 months ago

wokwong commented 6 months ago

Terraform Version

Terraform v1.7.4 on linux_amd64

Affected Resource(s)

Terraform Configuration Files

data "tencentcloud_security_groups" "selected" {
  security_group_id = "sg-nma6pdd3"
}

resource "tencentcloud_instance" "ops_recovery_tmp_sever" { 
.......

  instance_name = "ops_recovery_tmp_sever"
  orderly_security_groups = [
    data.tencentcloud_security_groups.selected.id,
  ]

.......

Expected Behavior

$ terraform plan -out plan.tfplan
......
data.tencentcloud_security_groups.selected: Read complete after 2s [id=sg-nma6pdd3]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # tencentcloud_instance.ops_recovery_tmp_sever[0] will be created
  + resource "tencentcloud_instance" "ops_recovery_tmp_sever" {
      .......
      + orderly_security_groups                 = [
          + "sg-nma6pdd3",
        ]
      ......
    }

Actual Behavior

$ terraform plan -out plan.tfplan
......
data.tencentcloud_security_groups.selected: Read complete after 2s [id=securityGroups-sg-nma6pdd3-]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # tencentcloud_instance.ops_recovery_tmp_sever[0] will be created
  + resource "tencentcloud_instance" "ops_recovery_tmp_sever" {
      .......
      + orderly_security_groups                 = [
          + "securityGroups-sg-nma6pdd3-",
        ]
      ......
    }
wokwong commented 6 months ago

企业微信截图_17090027388239

wokwong commented 6 months ago

sorry,I made a mistake,ishould have used data.tencentcloud_security_groups.selected.security_group_id .

walbertus commented 2 months ago

@wokwong please close this issue if it's already resolved