-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CCL-2010:Initial code for dynatrace_privatelink_aws_allowlist (#26)
* CCL-2010:Initial code for dynatrace_privatelink_aws_allowlist * Add --fail and rename variables --------- Co-authored-by: Chris Freeman <[email protected]> Co-authored-by: Chris Freeman <[email protected]>
- Loading branch information
1 parent
cb8b0e8
commit 1a19fb9
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
resource "terraform_data" "aws_allowlist" { | ||
for_each = toset(var.aws_account_Ids) | ||
|
||
provisioner "local-exec" { | ||
when = create | ||
command = <<EOF | ||
curl -X PUT "https://$${DYNATRACE_ENVIRONMENT_ID}.live.dynatrace.com/api/config/v1/aws/privateLink/allowlistedAccounts/${each.key}" \ | ||
-H "accept: application/json; charset=utf-8" \ | ||
-H "Authorization: Api-Token $${DYNATRACE_API_TOKEN}" \ | ||
-H "Content-Type: application/json; charset=utf-8" -d "{\"id\":\"${each.key}\"}" \ | ||
--fail | ||
EOF | ||
} | ||
provisioner "local-exec" { | ||
when = destroy | ||
command = <<EOF | ||
curl -X DELETE "https://$${DYNATRACE_ENVIRONMENT_ID}.live.dynatrace.com/api/config/v1/aws/privateLink/allowlistedAccounts/${each.key}" \ | ||
-H "accept: application/json; charset=utf-8" \ | ||
-H "Authorization: Api-Token $${DYNATRACE_API_TOKEN}" \ | ||
--fail | ||
EOF | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
variable "aws_accounts" { | ||
description = "AWS accounts to add to the Dynatrace allow listDynatrace AWS Account IDs" | ||
type = set(string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters