generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #930 from jackywong-amazon/d-improve-awscc_ecr_rep…
…ository docs - awscc_ecr_repository
- Loading branch information
Showing
5 changed files
with
189 additions
and
2 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
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,8 @@ | ||
resource "awscc_ecr_repository" "this" { | ||
repository_name = "example-ecr" | ||
image_tag_mutability = "MUTABLE" | ||
image_scanning_configuration = { | ||
scan_on_push = true | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
examples/resources/awscc_ecr_repository/ecr_repository_lifecycle_policy.tf
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 @@ | ||
resource "awscc_ecr_repository" "lifecycle_policy_example" { | ||
repository_name = "example-ecr-lifecycle-policy" | ||
image_tag_mutability = "MUTABLE" | ||
|
||
lifecycle_policy = { | ||
lifecycle_policy_text = <<EOF | ||
{ | ||
"rules": [ | ||
{ | ||
"rulePriority": 1, | ||
"description": "Expire images older than 14 days", | ||
"selection": { | ||
"tagStatus": "untagged", | ||
"countType": "sinceImagePushed", | ||
"countUnit": "days", | ||
"countNumber": 14 | ||
}, | ||
"action": { | ||
"type": "expire" | ||
} | ||
} | ||
] | ||
} | ||
EOF | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
examples/resources/awscc_ecr_repository/ecr_repository_repository_policy.tf
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,32 @@ | ||
resource "awscc_ecr_repository" "repo_policy_example" { | ||
repository_name = "example-ecr-repository-policy" | ||
image_tag_mutability = "MUTABLE" | ||
|
||
repository_policy_text = jsonencode( | ||
{ | ||
"Version" : "2012-10-17", | ||
"Statement" : [ | ||
{ | ||
"Sid" : "CodeBuildAccess", | ||
"Effect" : "Allow", | ||
"Principal" : { | ||
"Service" : "codebuild.amazonaws.com" | ||
}, | ||
"Action" : [ | ||
"ecr:BatchGetImage", | ||
"ecr:GetDownloadUrlForLayer" | ||
], | ||
"Condition" : { | ||
"ArnLike" : { | ||
"aws:SourceArn" : "arn:aws:codebuild:region:123456789012:project/project-name" | ||
}, | ||
"StringEquals" : { | ||
"aws:SourceAccount" : "123456789012" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
) | ||
|
||
} |
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,38 @@ | ||
--- | ||
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" | ||
subcategory: "" | ||
description: |- | ||
{{ .Description | plainmarkdown | trimspace | prefixlines " " }} | ||
--- | ||
|
||
# {{.Name}} ({{.Type}}) | ||
|
||
{{ .Description | trimspace }} | ||
|
||
## Example Usage | ||
|
||
### ECR Repository with scan on push | ||
To create ECR Repository with scan on push: | ||
|
||
{{ tffile (printf "examples/resources/%s/ecr_repository.tf" .Name)}} | ||
|
||
### ECR Repository with lifecycle policy | ||
To create ECR Repository with lifecycle policy that expires untagged images older than 14 days: | ||
|
||
{{ tffile (printf "examples/resources/%s/ecr_repository_lifecycle_policy.tf" .Name)}} | ||
|
||
### ECR Repository with repository policy | ||
To create ECR Repository with repository policy that allows AWS CodeBuild access to the Amazon ECR API actions: | ||
|
||
{{ tffile (printf "examples/resources/%s/ecr_repository_repository_policy.tf" .Name)}} | ||
|
||
{{ .SchemaMarkdown | trimspace }} | ||
{{- if .HasImport }} | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
{{ codefile "shell" .ImportFile }} | ||
|
||
{{- end }} |