@@ -9,14 +9,21 @@ import (
99func TestAccGithubActionsOrganizationOIDCCustomPropertyInclusion (t * testing.T ) {
1010 t .Run ("creates and deletes an OIDC custom property inclusion without error" , func (t * testing.T ) {
1111 config := `
12+ resource "github_organization_custom_properties" "test" {
13+ property_name = "tf-acc-test-oidc-env"
14+ value_type = "single_select"
15+ required = false
16+ allowed_values = ["production", "staging"]
17+ }
18+
1219 resource "github_actions_organization_oidc_custom_property_inclusion" "test" {
13- custom_property_name = "environment"
20+ custom_property_name = github_organization_custom_properties.test.property_name
1421 }`
1522
1623 check := resource .ComposeTestCheckFunc (
1724 resource .TestCheckResourceAttr (
1825 "github_actions_organization_oidc_custom_property_inclusion.test" ,
19- "custom_property_name" , "environment " ,
26+ "custom_property_name" , "tf-acc-test-oidc-env " ,
2027 ),
2128 )
2229 resource .Test (t , resource.TestCase {
@@ -33,14 +40,21 @@ func TestAccGithubActionsOrganizationOIDCCustomPropertyInclusion(t *testing.T) {
3340
3441 t .Run ("imports an OIDC custom property inclusion without error" , func (t * testing.T ) {
3542 config := `
43+ resource "github_organization_custom_properties" "test" {
44+ property_name = "tf-acc-test-oidc-import"
45+ value_type = "single_select"
46+ required = false
47+ allowed_values = ["production", "staging"]
48+ }
49+
3650 resource "github_actions_organization_oidc_custom_property_inclusion" "test" {
37- custom_property_name = "environment"
51+ custom_property_name = github_organization_custom_properties.test.property_name
3852 }`
3953
4054 check := resource .ComposeTestCheckFunc (
4155 resource .TestCheckResourceAttr (
4256 "github_actions_organization_oidc_custom_property_inclusion.test" ,
43- "custom_property_name" , "environment " ,
57+ "custom_property_name" , "tf-acc-test-oidc-import " ,
4458 ),
4559 )
4660
@@ -63,22 +77,35 @@ func TestAccGithubActionsOrganizationOIDCCustomPropertyInclusion(t *testing.T) {
6377
6478 t .Run ("manages multiple OIDC custom property inclusions" , func (t * testing.T ) {
6579 config := `
80+ resource "github_organization_custom_properties" "env" {
81+ property_name = "tf-acc-test-oidc-env2"
82+ value_type = "single_select"
83+ required = false
84+ allowed_values = ["production", "staging"]
85+ }
86+
87+ resource "github_organization_custom_properties" "team" {
88+ property_name = "tf-acc-test-oidc-team"
89+ value_type = "string"
90+ required = false
91+ }
92+
6693 resource "github_actions_organization_oidc_custom_property_inclusion" "env" {
67- custom_property_name = "environment"
94+ custom_property_name = github_organization_custom_properties.env.property_name
6895 }
6996
7097 resource "github_actions_organization_oidc_custom_property_inclusion" "team" {
71- custom_property_name = " team"
98+ custom_property_name = github_organization_custom_properties. team.property_name
7299 }`
73100
74101 check := resource .ComposeTestCheckFunc (
75102 resource .TestCheckResourceAttr (
76103 "github_actions_organization_oidc_custom_property_inclusion.env" ,
77- "custom_property_name" , "environment " ,
104+ "custom_property_name" , "tf-acc-test-oidc-env2 " ,
78105 ),
79106 resource .TestCheckResourceAttr (
80107 "github_actions_organization_oidc_custom_property_inclusion.team" ,
81- "custom_property_name" , "team" ,
108+ "custom_property_name" , "tf-acc-test-oidc- team" ,
82109 ),
83110 )
84111
@@ -98,8 +125,15 @@ func TestAccGithubActionsOrganizationOIDCCustomPropertyInclusion(t *testing.T) {
98125func TestAccGithubActionsOrganizationOIDCCustomPropertyInclusionsDataSource (t * testing.T ) {
99126 t .Run ("reads OIDC custom property inclusions without error" , func (t * testing.T ) {
100127 config := `
128+ resource "github_organization_custom_properties" "test" {
129+ property_name = "tf-acc-test-oidc-ds"
130+ value_type = "single_select"
131+ required = false
132+ allowed_values = ["production", "staging"]
133+ }
134+
101135 resource "github_actions_organization_oidc_custom_property_inclusion" "test" {
102- custom_property_name = "environment"
136+ custom_property_name = github_organization_custom_properties.test.property_name
103137 }
104138
105139 data "github_actions_organization_oidc_custom_property_inclusions" "test" {
0 commit comments