| 458 | } |
| 459 | |
| 460 | func TestLoadConfigFileWithGroups(t *testing.T) { |
| 461 | bam := "bam" |
| 462 | expected := configFile{ |
| 463 | CreationRules: []creationRule{ |
| 464 | { |
| 465 | PathRegex: "foobar*", |
| 466 | KMS: "1", |
| 467 | PGP: "2", |
| 468 | }, |
| 469 | { |
| 470 | PathRegex: "", |
| 471 | KeyGroups: []keyGroup{ |
| 472 | { |
| 473 | KMS: []kmsKey{ |
| 474 | { |
| 475 | Arn: "foo", |
| 476 | AwsProfile: "bar", |
| 477 | }, |
| 478 | { |
| 479 | Arn: "foo", |
| 480 | Context: map[string]*string{ |
| 481 | "baz": &bam, |
| 482 | }, |
| 483 | }, |
| 484 | { |
| 485 | Arn: "foo", |
| 486 | AwsProfile: "bar", |
| 487 | Context: map[string]*string{ |
| 488 | "baz": &bam, |
| 489 | }, |
| 490 | }, |
| 491 | { |
| 492 | Arn: "foo", |
| 493 | Role: "123", |
| 494 | }, |
| 495 | { |
| 496 | Arn: "foo", |
| 497 | AwsProfile: "bar", |
| 498 | Context: map[string]*string{ |
| 499 | "baz": &bam, |
| 500 | }, |
| 501 | Role: "123", |
| 502 | }, |
| 503 | }, |
| 504 | PGP: []string{"bar"}, |
| 505 | GCPKMS: []gcpKmsKey{{ResourceID: "foo"}}, |
| 506 | HCKms: []hckmsKey{{KeyID: "tr-west-1:test-key-1"}}, |
| 507 | AzureKV: []azureKVKey{{VaultURL: "https://foo.vault.azure.net", Key: "foo-key", Version: "fooversion"}}, |
| 508 | Vault: []string{"https://foo.vault:8200/v1/foo/keys/foo-key"}, |
| 509 | }, |
| 510 | { |
| 511 | KMS: []kmsKey{{Arn: "baz", AwsProfile: "foo"}}, |
| 512 | PGP: []string{"qux"}, |
| 513 | GCPKMS: []gcpKmsKey{ |
| 514 | {ResourceID: "bar"}, |
| 515 | {ResourceID: "baz"}, |
| 516 | }, |
| 517 | HCKms: []hckmsKey{{KeyID: "tr-west-1:test-key-2"}}, |