Skip to content

Commit 5a419fe

Browse files
author
Alexander Qiu
authored
Refactor Azure Service Principal Attributes (#140)
1 parent 5d627d2 commit 5a419fe

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

sysdig/data_source_sysdig_secure_trusted_cloud_identity.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func dataSourceSysdigSecureTrustedCloudIdentity() *schema.Resource {
4343
Type: schema.TypeString,
4444
Computed: true,
4545
},
46-
"azure_client_id": {
46+
"azure_service_principal_id": {
4747
Type: schema.TypeString,
4848
Computed: true,
4949
},
@@ -79,10 +79,10 @@ func dataSourceSysdigSecureTrustedCloudIdentityRead(ctx context.Context, d *sche
7979
}
8080
case "azure":
8181
// If identity is an Azure tenantID/clientID, separate into each part
82-
tenantID, clientID, err := parseAzureCreds(identity)
82+
tenantID, spID, err := parseAzureCreds(identity)
8383
if err == nil {
8484
_ = d.Set("azure_tenant_id", tenantID)
85-
_ = d.Set("azure_client_id", clientID)
85+
_ = d.Set("azure_service_principal_id", spID)
8686

8787
}
8888
}

sysdig/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ func validateDiagFunc(validateFunc func(interface{}, string) ([]string, []error)
3434
}
3535
}
3636

37-
// parseAzureCreds splits an Azure Trusted Identity into a tenantID and a clientID
38-
func parseAzureCreds(azureTrustedIdentity string) (tenantID string, clientID string, err error) {
37+
// parseAzureCreds splits an Azure Trusted Identity into a tenantID and a service principal ID
38+
func parseAzureCreds(azureTrustedIdentity string) (tenantID string, spID string, err error) {
3939
tokens := strings.Split(azureTrustedIdentity, ":")
4040
if len(tokens) != 2 {
4141
return "", "", errors.New("Not a valid Azure Trusted Identity")

website/docs/d/secure_trusted_cloud_identity.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ In addition to all arguments above, the following attributes are exported:
3535

3636
* `aws_role_name` - If `identity` is a AWS IAM Role ARN, this attribute contains the name of the role, otherwise it contains the empty string. `cloud_provider` must be equal to `aws` or `gcp`.
3737

38-
* `azure_tenant_id` - If `identity` contains credentials for an Azure Service Principal, this attribute contains its Tenant ID. `cloud_provider` must be equal to `azure`.
38+
* `azure_tenant_id` - If `identity` contains credentials for an Azure Service Principal, this attribute contains the service principal's Tenant ID. `cloud_provider` must be equal to `azure`.
3939

40-
* `azure_client_id` - If `identity` contains credentials for an Azure Service Principal, this attribute contains its Client ID. `cloud_provider` must be equal to `azure`.
40+
* `azure_service_principal_id` - If `identity` contains credentials for an Azure Service Principal, this attribute contains the service principal's ID. `cloud_provider` must be equal to `azure`.
4141

0 commit comments

Comments
 (0)