Skip to content

Commit

Permalink
Pass provider alias to cloud account creation call (#448)
Browse files Browse the repository at this point in the history
* Add provider alias to cloud account creation call

---------

Co-authored-by: Raghav Anandan <[email protected]>
  • Loading branch information
raghavanandan and Raghav Anandan authored Nov 17, 2023
1 parent b7a362a commit 9211e8e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions sysdig/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ const (
SchemaOrganizationIDKey = "organization_id"
SchemaOrganizationalUnitIds = "organizational_unit_ids"
SchemaCloudProviderTenantId = "provider_tenant_id"
SchemaCloudProviderAlias = "provider_alias"
)
10 changes: 10 additions & 0 deletions sysdig/resource_sysdig_secure_cloud_auth_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ func resourceSysdigSecureCloudauthAccount() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
SchemaCloudProviderAlias: {
Type: schema.TypeString,
Optional: true,
},
},
}
}
Expand Down Expand Up @@ -521,6 +525,7 @@ func cloudauthAccountFromResourceData(data *schema.ResourceData) *v2.CloudauthAc
Components: accountComponents,
Feature: accountFeatures,
ProviderTenantId: data.Get(SchemaCloudProviderTenantId).(string),
ProviderAlias: data.Get(SchemaCloudProviderAlias).(string),
},
}
}
Expand Down Expand Up @@ -742,6 +747,11 @@ func cloudauthAccountToResourceData(data *schema.ResourceData, cloudAccount *v2.
if err != nil {
return err
}

err = data.Set(SchemaCloudProviderAlias, cloudAccount.ProviderAlias)
if err != nil {
return err
}
}

return nil
Expand Down
2 changes: 2 additions & 0 deletions sysdig/resource_sysdig_secure_cloud_auth_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ resource "sysdig_secure_cloud_auth_account" "sample" {
provider_type = "PROVIDER_AZURE"
enabled = true
provider_tenant_id = "%s"
provider_alias = "some-alias"
}`, accountId, randomTenantId)
}

Expand Down Expand Up @@ -231,6 +232,7 @@ func secureAzureCloudAuthAccountWithFC(accountID string) string {
provider_type = "PROVIDER_AZURE"
enabled = true
provider_tenant_id = "%s"
provider_alias = "some-alias"
feature {
secure_config_posture {
enabled = true
Expand Down

0 comments on commit 9211e8e

Please sign in to comment.