Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/stable-website'
Browse files Browse the repository at this point in the history
  • Loading branch information
jocgir committed May 8, 2020
2 parents 2d26295 + f4c3449 commit ffd4f4a
Show file tree
Hide file tree
Showing 1,748 changed files with 138,441 additions and 131,055 deletions.
39 changes: 30 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 @@ -638,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 Expand Up @@ -691,12 +698,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 +831,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 +926,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
74 changes: 74 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Examples Checks
on:
push:
branches:
- master
pull_request:
paths:
- examples/**

env:
AWS_DEFAULT_REGION: us-west-2
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache

jobs:
terraform:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go_version: ["1.14"]
terraform_version: ["0.11.14", "0.12.24"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: git fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go_version }}
- name: go build
run: |
GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)
# Substitute as latest release
VERSION=$(git describe --abbrev=0 --match='v*.*.*' --tags || echo -n "v99.99.99")
go build -o ${TF_PLUGIN_CACHE_DIR}/${GOOS}_${GOARCH}/terraform-provider-aws_${VERSION}_x4 .
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ matrix.terraform_version }}
- name: terraform
run: |
for DIR in $(find ./examples -type f -name '*.tf' -exec dirname {} \; | sort -u); do
if [ ${{ matrix.terraform_version }} = 0.11.14 ]; then
if [ $DIR = ./examples/eks-getting-started ]; then
# Skip example already converted to Terraform 0.12 and later syntax
continue
elif [ $DIR = ./examples/two-tier ]; then
# 0.11 validation requires file path to exist
mkdir -p ~/.ssh
touch ~/.ssh/terraform-provider-aws-example.pub
fi
fi
pushd $DIR
if [ -f terraform.template.tfvars ]; then
cp terraform.template.tfvars terraform.tfvars
fi
echo; echo -e "\e[1;35m===> Initializing Example: $DIR <===\e[0m"; echo
terraform init
# Prefer Terraform 0.12 and later format checking to prevent conflicts
if [ ${{ matrix.terraform_version }} != 0.11.14 ]; then
echo; echo -e "\e[1;35m===> Format Checking Example: $DIR <===\e[0m"; echo
terraform fmt -check
fi
echo; echo -e "\e[1;35m===> Validating Example: $DIR <===\e[0m"; echo
terraform validate
popd
done
10 changes: 1 addition & 9 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ jobs:
- uses: actions/[email protected]
- name: Apply Issue Triage Label
uses: actions/[email protected]
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:
args: label needs-triage

- name: Add new issue into Triage Board
uses: alex-page/[email protected]
if: github.event.action == 'opened'
with:
project: AWS Provider Triage
column: Needs Triage
repo-token: ${{ secrets.GITHUB_ACTIONS_TOKEN }}
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
50 changes: 30 additions & 20 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 All @@ -51,7 +36,8 @@ behavior "deprecated_import_commenter" "hashicorp_terraform" {
}

behavior "opened_pull_request_labeler" "triage" {
labels = ["needs-triage"]
labels = ["needs-triage"]
skip_collaborators = true
}

queued_behavior "release_commenter" "releases" {
Expand Down Expand Up @@ -242,6 +228,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 @@ -344,6 +331,9 @@ behavior "regexp_issue_labeler_v2" "service_labels" {
"service/kinesisanalytics" = [
"aws_kinesis_analytics_",
],
"service/kinesisanalyticsv2" = [
"aws_kinesisanalyticsv2_",
],
"service/kms" = [
"aws_kms_",
],
Expand Down Expand Up @@ -440,7 +430,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 @@ -535,15 +525,25 @@ behavior "pull_request_path_labeler" "service_labels" {
label_map = {
# label provider related changes
"provider" = [
".github/**/*",
".gitignore",
".go-version",
".hashibot.hcl",
"aws/auth_helpers.go",
"aws/awserr.go",
"aws/config.go",
"aws/*_aws_arn*",
"aws/*_aws_ip_ranges*",
"aws/*_aws_partition*",
"aws/*_aws_region*",
"aws/internal/flatmap/*",
"aws/internal/keyvaluetags/*",
"aws/internal/naming/*",
"aws/provider.go",
"aws/utils.go",
"GNUmakefile",
"infrastructure/**/*",
"main.go",
"renovate.json",
"website/docs/index.html.markdown",
"website/**/arn*",
Expand All @@ -554,7 +554,11 @@ behavior "pull_request_path_labeler" "service_labels" {
# label test related changes
"tests" = [
"**/*_test.go",
"**/testdata/**/*",
"**/test-fixtures/**/*",
".github/workflows/*",
".gometalinter.json",
".markdownlinkcheck.json",
".markdownlint.yml",
".travis.yml",
"staticcheck.conf"
Expand Down Expand Up @@ -793,6 +797,7 @@ 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*",
Expand Down Expand Up @@ -821,6 +826,7 @@ 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*",
Expand Down Expand Up @@ -963,6 +969,10 @@ behavior "pull_request_path_labeler" "service_labels" {
"**/*_kinesis_analytics_*",
"**/kinesis_analytics_*"
]
"service/kinesisanalyticsv2" = [
"**/*_kinesisanalyticsv2_*",
"**/kinesisanalyticsv2_*"
]
"service/kms" = [
"**/*_kms_*",
"**/kms_*"
Expand Down Expand Up @@ -1094,8 +1104,8 @@ behavior "pull_request_path_labeler" "service_labels" {
"**/route53_zone*"
]
"service/route53domains" = [
"**/*_route53_domains_*",
"**/route53_domains_*"
"**/*_route53domains_*",
"**/route53domains_*"
]
"service/route53resolver" = [
"**/*_route53_resolver_*",
Expand Down
Loading

0 comments on commit ffd4f4a

Please sign in to comment.