-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'arn' attribute to 'aws_redshift_service_account' data source (#1775
) * Add 'arn' attribute to 'aws_redshift_service_account' data source. * Add 'arn.go' and associated tests.
- Loading branch information
1 parent
8c2c8c1
commit 354aee4
Showing
5 changed files
with
54 additions
and
7 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,26 @@ | ||
package aws | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws/arn" | ||
"github.com/aws/aws-sdk-go/service/iam" | ||
) | ||
|
||
func arnString(partition, region, service, accountId, resource string) string { | ||
return arn.ARN{ | ||
Partition: partition, | ||
Region: region, | ||
Service: service, | ||
AccountID: accountId, | ||
Resource: resource, | ||
}.String() | ||
} | ||
|
||
// See http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam | ||
func iamArnString(partition, accountId, resource string) string { | ||
return arnString( | ||
partition, | ||
"", | ||
iam.ServiceName, | ||
accountId, | ||
resource) | ||
} |
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,13 @@ | ||
package aws | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestArn_iamRootUser(t *testing.T) { | ||
arn := iamArnString("aws", "1234567890", "root") | ||
expectedArn := "arn:aws:iam::1234567890:root" | ||
if arn != expectedArn { | ||
t.Fatalf("Expected ARN: %s, got: %s", expectedArn, arn) | ||
} | ||
} |
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
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
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