Skip to content

Commit 2f0f407

Browse files
committed
feat: Validated unit tests and manual tests for OIDC custom property integration
1 parent 67e8de1 commit 2f0f407

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

  • examples/oidc_custom_property
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
terraform {
2+
required_providers {
3+
github = {
4+
source = "integrations/github"
5+
}
6+
}
7+
}
8+
9+
provider "github" {
10+
owner = var.github_owner
11+
}
12+
13+
variable "github_owner" {
14+
description = "The GitHub organization to manage"
15+
type = string
16+
}
17+
18+
# Step 1: Define an org-level custom property
19+
resource "github_organization_custom_properties" "environment" {
20+
property_name = "environment"
21+
value_type = "single_select"
22+
required = false
23+
allowed_values = ["production", "staging", "development"]
24+
}
25+
26+
# Step 2: Include the custom property in OIDC tokens
27+
resource "github_actions_organization_oidc_custom_property_inclusion" "environment" {
28+
custom_property_name = "environment"
29+
depends_on = [github_organization_custom_properties.environment]
30+
}
31+
32+
# Step 3: Read back the inclusions via data source
33+
data "github_actions_organization_oidc_custom_property_inclusions" "current" {
34+
depends_on = [github_actions_organization_oidc_custom_property_inclusion.environment]
35+
}
36+
37+
output "included_properties" {
38+
value = data.github_actions_organization_oidc_custom_property_inclusions.current.custom_property_names
39+
}

0 commit comments

Comments
 (0)