terraform-provider-tencentcloud icon indicating copy to clipboard operation
terraform-provider-tencentcloud copied to clipboard

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

Open wokwong opened this issue 1 year ago • 3 comments

Terraform Version

Terraform v1.7.4 on linux_amd64

  • provider registry.terraform.io/tencentcloudstack/tencentcloud v1.81.74

Affected Resource(s)

  • tencentcloud_security_groups

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 avatar Feb 27 '24 03:02 wokwong

企业微信截图_17090027388239

wokwong avatar Feb 27 '24 03:02 wokwong

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

wokwong avatar Feb 27 '24 03:02 wokwong

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

walbertus avatar Jun 29 '24 04:06 walbertus