Skip to content

Commit

Permalink
Merge branch 'master' into jstump-subnet-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Stump authored May 4, 2020
2 parents 2a725a5 + 89bb14b commit 8343f86
Show file tree
Hide file tree
Showing 1,817 changed files with 158,994 additions and 135,062 deletions.
38 changes: 29 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,12 @@ More details about this code generation, including fixes for potential error mes
}
```

- Otherwise if the API does not support tagging on creation (the `Input` struct does not accept a `Tags` field), in the resource `Create` function, implement the logic to convert the configuration tags into the service API call to tag a resource, e.g. with CloudHSM v2 Clusters:
- Otherwise if the API does not support tagging on creation (the `Input` struct does not accept a `Tags` field), in the resource `Create` function, implement the logic to convert the configuration tags into the service API call to tag a resource, e.g. with ElasticSearch Domain:

```go
if v := d.Get("tags").(map[string]interface{}); len(v) > 0 {
if err := keyvaluetags.Cloudhsmv2UpdateTags(conn, d.Id(), nil, v); err != nil {
return fmt.Errorf("error adding CloudHSM v2 Cluster (%s) tags: %s", d.Id(), err)
if err := keyvaluetags.ElasticsearchserviceUpdateTags(conn, d.Id(), nil, v); err != nil {
return fmt.Errorf("error adding Elasticsearch Cluster (%s) tags: %s", d.Id(), err)
}
}
```
Expand All @@ -429,21 +429,27 @@ More details about this code generation, including fixes for potential error mes
- In the resource `Read` function, implement the logic to convert the service tags to save them into the Terraform state for drift detection, e.g. with EKS Clusters (which had the tags available in the DescribeCluster API call):

```go
if err := d.Set("tags", keyvaluetags.EksKeyValueTags(cluster.Tags).IgnoreAws().Map()); err != nil {
// Typically declared near conn := /* ... */
ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig

if err := d.Set("tags", keyvaluetags.EksKeyValueTags(cluster.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil {
return fmt.Errorf("error setting tags: %s", err)
}
```

If the service API does not return the tags directly from reading the resource and requires a separate API call, its possible to use the `keyvaluetags` functionality like the following, e.g. with Athena Workgroups:

```go
// Typically declared near conn := /* ... */
ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig

tags, err := keyvaluetags.AthenaListTags(conn, arn.String())

if err != nil {
return fmt.Errorf("error listing tags for resource (%s): %s", arn, err)
}

if err := d.Set("tags", tags.IgnoreAws().Map()); err != nil {
if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil {
return fmt.Errorf("error setting tags: %s", err)
}
```
Expand Down Expand Up @@ -691,12 +697,12 @@ While region validation is automatically added with SDK updates, new regions
are generally limited in which services they support. Below are some
manually sourced values from documentation.

- [ ] Check [Regions and Endpoints ELB regions](https://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region) and add Route53 Hosted Zone ID if available to `aws/data_source_aws_elb_hosted_zone_id.go`
- [ ] Check [Regions and Endpoints S3 website endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints) and add Route53 Hosted Zone ID if available to `aws/hosted_zones.go`
- [ ] Check [Elastic Load Balancing endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/elb.html#elb_region) and add Route53 Hosted Zone ID if available to `aws/data_source_aws_elb_hosted_zone_id.go`
- [ ] Check [Amazon Simple Storage Service endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/s3.html#s3_region) and add Route53 Hosted Zone ID if available to `aws/hosted_zones.go`
- [ ] Check [CloudTrail Supported Regions docs](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-supported-regions.html#cloudtrail-supported-regions) and add AWS Account ID if available to `aws/data_source_aws_cloudtrail_service_account.go`
- [ ] Check [Elastic Load Balancing Access Logs docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy) and add Elastic Load Balancing Account ID if available to `aws/data_source_aws_elb_service_account.go`
- [ ] Check [Redshift Database Audit Logging docs](https://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-bucket-permissions) and add AWS Account ID if available to `aws/data_source_aws_redshift_service_account.go`
- [ ] Check [Regions and Endpoints Elastic Beanstalk](https://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region) and add Route53 Hosted Zone ID if available to `aws/data_source_aws_elastic_beanstalk_hosted_zone.go`
- [ ] Check [AWS Elastic Beanstalk endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/elasticbeanstalk.html#elasticbeanstalk_region) and add Route53 Hosted Zone ID if available to `aws/data_source_aws_elastic_beanstalk_hosted_zone.go`

### Common Review Items

Expand Down Expand Up @@ -824,7 +830,19 @@ The below are location-based items that _may_ be noted during review and are rec
}
```

- [ ] __Uses aws_availability_zones Data Source__: Any hardcoded AWS Availability Zone configuration, e.g. `us-west-2a`, should be replaced with the [`aws_availability_zones` data source](https://www.terraform.io/docs/providers/aws/d/availability_zones.html). A common pattern is declaring `data "aws_availability_zones" "current" {}` and referencing it via `data.aws_availability_zones.current.names[0]` or `data.aws_availability_zones.current.names[count.index]` in resources utilizing `count`.
- [ ] __Uses aws_availability_zones Data Source__: Any hardcoded AWS Availability Zone configuration, e.g. `us-west-2a`, should be replaced with the [`aws_availability_zones` data source](https://www.terraform.io/docs/providers/aws/d/availability_zones.html). A common pattern is declaring `data "aws_availability_zones" "available" {...}` and referencing it via `data.aws_availability_zones.available.names[0]` or `data.aws_availability_zones.available.names[count.index]` in resources utilizing `count`.

```hcl
data "aws_availability_zones" "available" {
state = "available"
filter {
name = "opt-in-status"
values = ["opt-in-not-required"]
}
}
```

- [ ] __Uses aws_region Data Source__: Any hardcoded AWS Region configuration, e.g. `us-west-2`, should be replaced with the [`aws_region` data source](https://www.terraform.io/docs/providers/aws/d/region.html). A common pattern is declaring `data "aws_region" "current" {}` and referencing it via `data.aws_region.current.name`
- [ ] __Uses aws_partition Data Source__: Any hardcoded AWS Partition configuration, e.g. the `aws` in a `arn:aws:SERVICE:REGION:ACCOUNT:RESOURCE` ARN, should be replaced with the [`aws_partition` data source](https://www.terraform.io/docs/providers/aws/d/partition.html). A common pattern is declaring `data "aws_partition" "current" {}` and referencing it via `data.aws_partition.current.partition`
- [ ] __Uses Builtin ARN Check Functions__: Tests should utilize available ARN check functions, e.g. `testAccMatchResourceAttrRegionalARN()`, to validate ARN attribute values in the Terraform state over `resource.TestCheckResourceAttrSet()` and `resource.TestMatchResourceAttr()`
Expand Down Expand Up @@ -907,6 +925,8 @@ PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 55.619s
```

Please Note: On macOS 10.14 and later (and some Linux distributions), the default user open file limit is 256. This may cause unexpected issues when running the acceptance testing since this can prevent various operations from occurring such as opening network connections to AWS. To view this limit, the `ulimit -n` command can be run. To update this limit, run `ulimit -n 1024` (or higher).

#### Writing an Acceptance Test

Terraform has a framework for writing acceptance tests which minimises the
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v1.0.0
- name: Apply Issue Triage Label
uses: actions/github@v1.0.0
if: github.event.action == 'opened'
if: github.event.action == 'opened' && !contains(fromJSON('["bflad", "breathingdust", "ewbankkit", "gdavison", "maryelizbeth"]'), github.actor)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Stale issues and pull requests"
on:
schedule:
- cron: "40 17 * * *"

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 720
days-before-close: 30
exempt-issue-label: 'needs-triage'
exempt-pr-label: 'needs-triage'
operations-per-run: 100
stale-issue-label: 'stale'
stale-issue-message: |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
stale-pr-label: 'stale'
stale-pr-message: |
Marking this pull request as stale due to inactivity. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!
21 changes: 21 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Website Checks
on:
push:
branches:
- master
pull_request:
paths:
- website/docs/**

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: '.markdownlinkcheck.json'
folder-path: 'website/docs'
file-extension: '.markdown'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ website/node_modules
*.test
*.iml
log.txt

markdown-link-check*.txt
website/vendor

# Test exclusions
Expand Down
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.13.7
45 changes: 23 additions & 22 deletions .hashibot.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
poll "closed_issue_locker" "locker" {
schedule = "0 50 14 * * *"
schedule = "0 10 17 * * *"
closed_for = "720h" # 30 days
max_issues = 500
sleep_between_issues = "5s"
Expand All @@ -11,21 +11,6 @@ poll "closed_issue_locker" "locker" {
EOF
}

poll "stale_issue_closer" "closer" {
schedule = "0 22 23 * * *"
no_reply_in_last = "2160h" # 90 days
max_issues = 500
sleep_between_issues = "5s"
created_after = "2019-06-01"
exclude_labels = ["needs-triage", "technical-debt"]
extra_search_params = "reactions:<20 no:milestone no:assignee"
message = <<-EOF
I'm going to close this issue due to inactivity (_90 days_ without response ⏳ ). This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
EOF
}

behavior "deprecated_import_commenter" "hashicorp_terraform" {
import_regexp = "github.com/hashicorp/terraform/"
marker_label = "terraform-plugin-sdk-migration"
Expand Down Expand Up @@ -99,6 +84,7 @@ behavior "regexp_issue_labeler_v2" "service_labels" {
],
"service/apigatewayv2" = [
"aws_api_gateway_v2_",
"aws_apigatewayv2_",
],
"service/applicationautoscaling" = [
"aws_appautoscaling_",
Expand Down Expand Up @@ -241,6 +227,7 @@ behavior "regexp_issue_labeler_v2" "service_labels" {
"aws_main_route_table_association",
"aws_network_interface",
"aws_placement_group",
"aws_prefix_list",
"aws_spot",
"aws_route(\"|`|$)",
"aws_vpn_",
Expand Down Expand Up @@ -439,7 +426,7 @@ behavior "regexp_issue_labeler_v2" "service_labels" {
"aws_route53_([^d]|d[^o]|do[^m]|dom[^a]|doma[^i]|domai[^n]|domain[^s]|domains[^_]|[^r]|r[^e]|re[^s]|res[^o]|reso[^l]|resol[^v]|resolv[^e]|resolve[^r]|resolver[^_])",
],
"service/route53domains" = [
"aws_route53_domains_",
"aws_route53domains_",
],
"service/route53resolver" = [
"aws_route53_resolver_",
Expand Down Expand Up @@ -534,6 +521,7 @@ behavior "pull_request_path_labeler" "service_labels" {
label_map = {
# label provider related changes
"provider" = [
".github/*.md",
"aws/auth_helpers.go",
"aws/awserr.go",
"aws/config.go",
Expand All @@ -543,6 +531,7 @@ behavior "pull_request_path_labeler" "service_labels" {
"aws/*_aws_region*",
"aws/provider.go",
"aws/utils.go",
"renovate.json",
"website/docs/index.html.markdown",
"website/**/arn*",
"website/**/ip_ranges*",
Expand All @@ -553,7 +542,9 @@ behavior "pull_request_path_labeler" "service_labels" {
"tests" = [
"**/*_test.go",
".gometalinter.json",
".travis.yml"
".markdownlint.yml",
".travis.yml",
"staticcheck.conf"
]
# label services
"service/accessanalyzer" = [
Expand Down Expand Up @@ -584,7 +575,9 @@ behavior "pull_request_path_labeler" "service_labels" {
]
"service/apigatewayv2" = [
"**/*_api_gateway_v2_*",
"**/api_gateway_v2_*"
"**/*_apigatewayv2_*",
"**/api_gateway_v2_*",
"**/apigatewayv2_*"
]
"service/applicationautoscaling" = [
"**/*_appautoscaling_*",
Expand Down Expand Up @@ -714,6 +707,10 @@ behavior "pull_request_path_labeler" "service_labels" {
"aws/*_aws_config_*",
"website/**/config_*"
]
"service/costandusagereportservice" = [
"aws/*_aws_cur_*",
"website/**/cur_*"
]
"service/databasemigrationservice" = [
"**/*_dms_*",
"**/dms_*"
Expand Down Expand Up @@ -783,9 +780,11 @@ behavior "pull_request_path_labeler" "service_labels" {
"aws/*_aws_network_acl*",
"aws/*_aws_network_interface*",
"aws/*_aws_placement_group*",
"aws/*_aws_prefix_list*",
"aws/*_aws_route_table*",
"aws/*_aws_route.*",
"aws/*_aws_security_group*",
"aws/*_aws_snapshot_create_volume_permission*",
"aws/*_aws_spot*",
"aws/*_aws_subnet*",
"aws/*_aws_vpc*",
Expand All @@ -810,11 +809,13 @@ behavior "pull_request_path_labeler" "service_labels" {
"website/**/network_acl*",
"website/**/network_interface*",
"website/**/placement_group*",
"website/**/prefix_list*",
"website/**/route_table*",
"website/**/route.*",
"website/**/security_group*",
"website/**/snapshot_create_volume_permission*",
"website/**/spot_*",
"website/**/subnet.*",
"website/**/subnet*",
"website/**/vpc*",
"website/**/vpn*"
]
Expand Down Expand Up @@ -1082,8 +1083,8 @@ behavior "pull_request_path_labeler" "service_labels" {
"**/route53_zone*"
]
"service/route53domains" = [
"**/*_route53_domains_*",
"**/route53_domains_*"
"**/*_route53domains_*",
"**/route53domains_*"
]
"service/route53resolver" = [
"**/*_route53_resolver_*",
Expand Down
33 changes: 33 additions & 0 deletions .markdownlinkcheck.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"ignorePatterns": [
{
"pattern": "^http(s)?://(?!(docs\\.aws\\.amazon\\.com|github.com|(www\\.)?terraform\\.io))"
}
],
"replacementPatterns": [
{
"pattern": "^(/docs/(?!providers/aws/))",
"replacement": "https://terraform.io$1"
},
{
"pattern": "^(?!http(s)?://)(.*)\\.html(#.*)?$",
"replacement": "$2.html.markdown$3"
},
{
"pattern": "^/docs/providers/aws/",
"replacement": "file:///github/workspace/website/docs/"
},
{
"pattern": "^file:///github/workspace/website/docs/guides/(.*)\\.markdown(#.*)?$",
"replacement": "file:///github/workspace/website/docs/guides/$1.md$2"
},
{
"pattern": "^file:///github/workspace/website/docs/d/(cognito_user_pools)\\.html\\.markdown(#.*)?$",
"replacement": "file:///github/workspace/website/docs/d/$1.markdown$2"
},
{
"pattern": "^file:///github/workspace/website/docs/r/(cognito_identity_pool|cognito_user_pool|iam_role_policy_attachment|iam_user_policy_attachment|network_interface|ram_principal_association|ram_resource_share|ram_resource_share_accepter)\\.html\\.markdown(#.*)?$",
"replacement": "file:///github/workspace/website/docs/r/$1.markdown$2"
}
]
}
Loading

0 comments on commit 8343f86

Please sign in to comment.