Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[datadog_integration_aws] Allow account_id to be specified in an access_key configured integration #2154

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions datadog/resource_datadog_integration_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ func resourceDatadogIntegrationAws() *schema.Resource {
SchemaFunc: func() map[string]*schema.Schema {
return map[string]*schema.Schema{
"account_id": {
Description: "Your AWS Account ID without dashes.",
Type: schema.TypeString,
Optional: true,
ConflictsWith: []string{"access_key_id", "secret_access_key"},
Description: "Your AWS Account ID without dashes.",
Type: schema.TypeString,
Optional: true,
},
"role_name": {
Description: "Your Datadog role delegation name.",
Expand Down Expand Up @@ -76,14 +75,14 @@ func resourceDatadogIntegrationAws() *schema.Resource {
"access_key_id": {
Description: "Your AWS access key ID. Only required if your AWS account is a GovCloud or China account.",
Type: schema.TypeString,
ConflictsWith: []string{"account_id", "role_name"},
ConflictsWith: []string{"role_name"},
Optional: true,
},
"secret_access_key": {
Description: "Your AWS secret access key. Only required if your AWS account is a GovCloud or China account.",
Type: schema.TypeString,
Sensitive: true,
ConflictsWith: []string{"account_id", "role_name"},
ConflictsWith: []string{"role_name"},
Optional: true,
},
"metrics_collection_enabled": {
Expand Down Expand Up @@ -241,7 +240,9 @@ func resourceDatadogIntegrationAwsRead(ctx context.Context, d *schema.ResourceDa
for _, integration := range integrations.GetAccounts() {
if (accountID != "" && integration.GetAccountId() == accountID && integration.GetRoleName() == roleName) ||
(accessKeyID != "" && integration.GetAccessKeyId() == accessKeyID) {
d.Set("account_id", integration.GetAccountId())
if account_id, ok := integration.GetAccountIdOk(); ok {
d.Set("account_id", account_id)
}
d.Set("role_name", integration.GetRoleName())
d.Set("access_key_id", integration.GetAccessKeyId())
d.Set("filter_tags", integration.GetFilterTags())
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021-10-22T14:15:03.595223-04:00
2023-10-27T14:35:22.014995-04:00
Loading