Skip to content

Commit

Permalink
infrastructure/repository: Lift and shift Terraform configuration for…
Browse files Browse the repository at this point in the history
… managing certain repository labels (hashicorp#13212)

Migrating from `terraform-repositories`, where it was already separately handled. Other more sensitive repository management and labeling will remain there. After this is merged, will update Terraform Cloud VCS to point at this repository and path so it can automatically trigger runs on the default branch and pull requests when this directory is updated.
  • Loading branch information
bflad authored May 7, 2020
1 parent 6effb12 commit 115d68b
Show file tree
Hide file tree
Showing 8 changed files with 256 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ into Terraform.
- In `website/allowed-subcategories.txt`: Add a name acceptable for the documentation navigation.
- In `website/docs/guides/custom-service-endpoints.html.md`: Add the service
name in the list of customizable endpoints.
- In `infrastructure/repository/labels-service.tf`: Add the new service to create a repository label.
- In `.hashibot.hcl`: Add the new service to automated issue and pull request labeling. e.g. with the `quicksight` service

```hcl
Expand Down
1 change: 1 addition & 0 deletions .hashibot.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ behavior "pull_request_path_labeler" "service_labels" {
"aws/provider.go",
"aws/utils.go",
"GNUmakefile",
"infrastructure/**/*",
"main.go",
"renovate.json",
"website/docs/index.html.markdown",
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# infrastructure

Terraform configurations for managing Terraform AWS Provider infrastructure components.

- [repository](./repository): Manages the code repository, e.g. labels.
5 changes: 5 additions & 0 deletions infrastructure/repository/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# repository

Public Terraform configuration for managing the `terraform-provider-aws` code repository, to enable community contributions. Currently only utilized for managing AWS Partition, AWS Service, and workflow labels.

HashiCorp maintainers should utilize the `terraform-repositories` repository for managing more sensitive configuration.
18 changes: 18 additions & 0 deletions infrastructure/repository/labels-partition.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "partition_labels" {
default = [
"aws-cn",
"aws-iso",
"aws-iso-b",
"aws-us-gov",
]
description = "Set of AWS Partition labels"
type = set(string)
}

resource "github_issue_label" "partition" {
for_each = var.partition_labels

repository = "terraform-provider-aws"
name = "partition/${each.value}"
color = "bfd4f2"
}
194 changes: 194 additions & 0 deletions infrastructure/repository/labels-service.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
#
# For future consideration, this list could be automatically generated
# via the AWS SDK service list.
#

variable "service_labels" {
default = [
"accessanalyzer",
"acm",
"acmpca",
"alexaforbusiness",
"amplify",
"apigateway",
"apigatewaymanagementapi",
"apigatewayv2",
"appconfig",
"applicationautoscaling",
"applicationdiscoveryservice",
"applicationinsights",
"appmesh",
"appstream",
"appsync",
"athena",
"autoscaling",
"autoscalingplans",
"backup",
"batch",
"budgets",
"chime",
"cloud9",
"clouddirectory",
"cloudformation",
"cloudfront",
"cloudhsm",
"cloudhsmv2",
"cloudsearch",
"cloudtrail",
"cloudwatch",
"cloudwatchevents",
"cloudwatchlogs",
"codebuild",
"codecommit",
"codedeploy",
"codeguruprofiler",
"codegurureviewer",
"codepipeline",
"codestar",
"codestarnotifications",
"cognito",
"comprehend",
"comprehendmedical",
"computeoptimizer",
"configservice",
"connect",
"costandusagereportservice",
"databasemigrationservice",
"dataexchange",
"datapipeline",
"datasync",
"dax",
"devicefarm",
"directconnect",
"directoryservice",
"dlm",
"docdb",
"dynamodb",
"ec2-classic",
"ec2",
"ecr",
"ecs",
"efs",
"eks",
"elastic-transcoder",
"elasticache",
"elasticbeanstalk",
"elasticinference",
"elasticsearch",
"elb",
"elbv2",
"emr",
"eventbridge",
"firehose",
"fms",
"forecastservice",
"frauddetector",
"fsx",
"gamelift",
"glacier",
"globalaccelerator",
"glue",
"greengrass",
"groundstation",
"guardduty",
"iam",
"imagebuilder",
"inspector",
"iot",
"iotanalytics",
"iotevents",
"iotsecuretunneling",
"iotthingsgraph",
"kafka",
"kendra",
"kinesis",
"kinesisanalytics",
"kinesisanalyticsv2",
"kinesisvideo",
"kms",
"lakeformation",
"lambda",
"lexmodelbuildingservice",
"licensemanager",
"lightsail",
"machinelearning",
"macie",
"managedblockchain",
"marketplacecatalog",
"mediaconnect",
"mediaconvert",
"medialive",
"mediapackage",
"mediapackagevod",
"mediastore",
"mediatailor",
"meteringmarketplace",
"mobile",
"mq",
"neptune",
"networkmanager",
"opsworks",
"organizations",
"outposts",
"personalize",
"pi",
"pinpoint",
"pinpointemail",
"pinpointsmsvoice",
"polly",
"pricing",
"qldb",
"quicksight",
"ram",
"rds",
"redshift",
"resourcegroups",
"robomaker",
"route53",
"route53domains",
"route53resolver",
"s3",
"s3control",
"sagemaker",
"savingsplans",
"secretsmanager",
"securityhub",
"serverlessapplicationrepository",
"servicecatalog",
"servicediscovery",
"servicequotas",
"ses",
"sesv2",
"sfn",
"shield",
"simpledb",
"sms",
"snowball",
"sns",
"sqs",
"ssm",
"storagegateway",
"sts",
"support",
"swf",
"transcribeservice",
"transfer",
"waf",
"wafv2",
"workdocs",
"worklink",
"workmail",
"workspaces",
"xray",
]
description = "Set of AWS Go SDK service labels"
type = set(string)
}

resource "github_issue_label" "service" {
for_each = var.service_labels

repository = "terraform-provider-aws"
name = "service/${each.value}"
color = "bfd4f2"
}
17 changes: 17 additions & 0 deletions infrastructure/repository/labels-workflow.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
variable "workflow_labels" {
default = {
"hacktoberfest" = "2c0fad",
"needs-triage" = "e236d7",
"terraform-plugin-sdk-migration" = "fad8c7",
}
description = "Name-color mapping of workflow issues"
type = map(string)
}

resource "github_issue_label" "workflow" {
for_each = var.workflow_labels

repository = "terraform-provider-aws"
name = each.key
color = each.value
}
15 changes: 15 additions & 0 deletions infrastructure/repository/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
backend "atlas" {
name = "hashicorp-v2/terraform-provider-aws-repository"
}

required_providers {
github = "2.1.0"
}

required_version = "~> 0.12.24"
}

provider "github" {
organization = "terraform-providers"
}

0 comments on commit 115d68b

Please sign in to comment.