@@ -67,6 +67,31 @@ func TestAccTFEVariableSetsDataSource_full(t *testing.T) {
67
67
)
68
68
}
69
69
70
+ func TestAccTFEVariableSetsDataSource_ProjectOwned (t * testing.T ) {
71
+ skipUnlessBeta (t )
72
+
73
+ rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
74
+ orgName := fmt .Sprintf ("org-%d" , rInt )
75
+
76
+ resource .Test (t , resource.TestCase {
77
+ PreCheck : func () { testAccPreCheck (t ) },
78
+ ProtoV5ProviderFactories : testAccMuxedProviders ,
79
+ Steps : []resource.TestStep {
80
+ {
81
+ Config : testAccTFEVariableSetsDataSourceConfig_ProjectOwned (rInt ),
82
+ Check : resource .ComposeAggregateTestCheckFunc (
83
+ resource .TestCheckResourceAttrSet ("data.tfe_variable_set.project_owned" , "id" ),
84
+ resource .TestCheckResourceAttr (
85
+ "data.tfe_variable_set.project_owned" , "organization" , orgName ),
86
+ resource .TestCheckResourceAttrPair (
87
+ "data.tfe_variable_set.project_owned" , "parent_project_id" , "tfe_project.foobar" , "id" ),
88
+ ),
89
+ },
90
+ },
91
+ },
92
+ )
93
+ }
94
+
70
95
func testAccTFEVariableSetsDataSourceConfig_basic (rInt int ) string {
71
96
return fmt .Sprintf (`
72
97
resource "tfe_organization" "foobar" {
@@ -130,3 +155,27 @@ func testAccTFEVariableSetsDataSourceConfig_full(rInt int) string {
130
155
depends_on = [tfe_variable.envfoo, tfe_project_variable_set.foobar]
131
156
}` , rInt , rInt , rInt , rInt )
132
157
}
158
+
159
+ func testAccTFEVariableSetsDataSourceConfig_ProjectOwned (rInt int ) string {
160
+ return fmt .Sprintf (`
161
+ resource "tfe_organization" "foobar" {
162
+ name = "org-%d"
163
+
164
+ }
165
+ resource "tfe_project" "foobar" {
166
+ organization = tfe_organization.foobar.id
167
+ name = "project-%d"
168
+ }
169
+
170
+ resource "tfe_variable_set" "project_owned" {
171
+ name = "project_owned_variable_set_test"
172
+ organization = tfe_organization.foobar.id
173
+ parent_project_id = tfe_project.foobar.id
174
+ }
175
+
176
+ data "tfe_variable_set" "project_owned" {
177
+ name = tfe_variable_set.project_owned.name
178
+ organization = tfe_variable_set.project_owned.organization
179
+ }
180
+ ` , rInt , rInt )
181
+ }
0 commit comments