Skip to content

Commit

Permalink
Merge branch 'master' into 11207_import_aws_batch_job_definition
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad authored Feb 6, 2020
2 parents 96d0dd6 + 3452fde commit 30380f9
Show file tree
Hide file tree
Showing 1,382 changed files with 200,737 additions and 96,408 deletions.
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ into Terraform.
- In `aws/config.go`: Create the new service client in the `{SERVICE}conn`
field in the `AWSClient` instantiation within `Client()`. e.g.
`quicksightconn: quicksight.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["quicksight"])})),`
- 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 `.hashibot.hcl`: Add the new service to automated issue and pull request labeling. e.g. with the `quicksight` service
Expand Down
26 changes: 23 additions & 3 deletions .github/MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
- [Pull Request Review Process](#pull-request-review-process)
- [Dependency Updates](#dependency-updates)
- [AWS Go SDK Updates](#aws-go-sdk-updates)
- [Terraform Updates](#terraform-updates)
- [golangci-lint Updates](#golangci-lint-updates)
- [Terraform Plugin SDK Updates](#terraform-plugin-sdk-updates)
- [tfproviderdocs Updates](#tfproviderdocs-updates)
- [tfproviderlint Updates](#tfproviderlint-updates)
- [yaml.v2 Updates](#yaml-v2-updates)
- [Pull Request Merge Process](#pull-request-merge-process)
- [Pull Request Types to CHANGELOG](#pull-request-types-to-changelog)
- [Release Process](#release-process)
Expand Down Expand Up @@ -241,9 +245,25 @@ ENHANCEMENTS:
* backend/s3: Support automatic region validation for `XX-XXXXX-#` [GH-####]
```

##### Terraform Updates
##### golangci-lint Updates

Run the full acceptance testing suite against the pull request and verify there are no new or unexpected failures.
Merge if CI passes.

##### Terraform Plugin SDK Updates

Except for trivial changes, run the full acceptance testing suite against the pull request and verify there are no new or unexpected failures.

##### tfproviderdocs Updates

Merge if CI passes.

##### tfproviderlint Updates

Merge if CI passes.

##### yaml.v2 Updates

Run the acceptance testing pattern, `TestAccAWSCloudFormationStack(_dataSource)?_yaml`, and merge if passing.

### Pull Request Merge Process

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/changelog_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CHANGELOG Checks
on:
pull_request:
paths:
- CHANGELOG.md

jobs:
PRCheck:
name: PR Check
runs-on: ubuntu-latest
steps:
- name: PR Comment
uses: unsplash/comment-on-pr@v1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: |-
Thank you for your contribution! :rocket:
Please note that the `CHANGELOG.md` file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md) for additional pull request review items.
Remove any changes to the `CHANGELOG.md` file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.
- name: Fail the check
run: exit 1
2 changes: 2 additions & 0 deletions .hashibot.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,8 @@ behavior "pull_request_path_labeler" "service_labels" {
"**/eks_*"
]
"service/elastic-transcoder" = [
"**/*_elastictranscoder_*",
"**/elastictranscoder_*",
"**/*_elastic_transcoder_*",
"**/elastic_transcoder_*"
]
Expand Down
30 changes: 30 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Configuration for markdownlint
# https://github.com/DavidAnson/markdownlint#configuration

default: true

# Disabled Rules
# https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md

MD001: false
MD003: false
MD004: false
MD006: false
MD007: false
MD009: false
MD010: false
MD012: false
MD013: false
MD014: false
MD018: false
MD019: false
MD022: false
MD024: false
MD026: false
MD030: false
MD033: false
MD034: false
MD038: false
MD040: false
MD046: false
MD047: false
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ matrix:
script: make lint
- go: "1.13.x"
name: "Code UnitTest"
script: make test
script:
- make test
- make gencheck
- go: "1.13.x"
name: "Dependencies"
script: make depscheck
Expand Down
186 changes: 180 additions & 6 deletions CHANGELOG.md

Large diffs are not rendered by default.

26 changes: 23 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gen:

sweep:
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
go test $(TEST) -v -sweep=$(SWEEP) $(SWEEPARGS)
go test $(TEST) -v -sweep=$(SWEEP) $(SWEEPARGS) -timeout 60m

test: fmtcheck
go test $(TEST) -timeout=30s -parallel=4
Expand All @@ -31,6 +31,12 @@ fmt:
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

gencheck:
@echo "==> Checking generated source code..."
@$(MAKE) gen
@git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'make gen' command and commit."; exit 1)

websitefmtcheck:
@sh -c "'$(CURDIR)/scripts/websitefmtcheck.sh'"

Expand All @@ -46,15 +52,19 @@ depscheck:

docscheck:
@tfproviderdocs check \
-allowed-resource-subcategories-file website/allowed-subcategories.txt \
-require-resource-subcategory

lint:
@echo "==> Checking source code against linters..."
@golangci-lint run ./$(PKG_NAME)/...
@tfproviderlint \
@awsproviderlint \
-c 1 \
-AT001 \
-AT002 \
-AT006 \
-AT007 \
-R004 \
-S001 \
-S002 \
-S003 \
Expand All @@ -72,11 +82,20 @@ lint:
-S016 \
-S017 \
-S019 \
-S021 \
-S025 \
-S026 \
-S027 \
-S028 \
-S029 \
-S030 \
-V003 \
-V006 \
./$(PKG_NAME)

tools:
GO111MODULE=on go install ./awsproviderlint
GO111MODULE=on go install github.com/bflad/tfproviderdocs
GO111MODULE=on go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
GO111MODULE=on go install github.com/client9/misspell/cmd/misspell
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint

Expand All @@ -98,6 +117,7 @@ endif
website-lint:
@echo "==> Checking website against linters..."
@misspell -error -source=text website/
@docker run -v $(PWD):/markdown 06kellyjac/markdownlint-cli website/docs/

website-test:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Using the Provider

To use a released provider in your Terraform environment, run [`terraform init`](https://www.terraform.io/docs/commands/init.html) and Terraform will automatically install the provider. To specify a particular provider version when installing released providers, see the [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#version-provider-versions).

To instead use a custom-built provider in your Terraform environment (e.g. the provider binary from the build instructions above), follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin) After placing it into your plugins directory, run `terraform init` to initialize it.
To instead use a custom-built provider in your Terraform environment (e.g. the provider binary from the build instructions above), follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/plugins/basics.html#installing-plugins) After placing the custom-built provider into your plugins directory, run `terraform init` to initialize it.

For either installation method, documentation about the provider specific configuration options can be found on the [provider's website](https://www.terraform.io/docs/providers/aws/index.html).

Expand Down
13 changes: 13 additions & 0 deletions aws/awserr.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ func isAWSErr(err error, code string, message string) bool {
return false
}

// Returns true if the error matches all these conditions:
// * err is of type awserr.RequestFailure
// * RequestFailure.StatusCode() matches status code
// It is always preferable to use isAWSErr() except in older APIs (e.g. S3)
// that sometimes only respond with status codes.
func isAWSErrRequestFailureStatusCode(err error, statusCode int) bool {
var awsErr awserr.RequestFailure
if errors.As(err, &awsErr) {
return awsErr.StatusCode() == statusCode
}
return false
}

func retryOnAwsCode(code string, f func() (interface{}, error)) (interface{}, error) {
var resp interface{}
err := resource.Retry(2*time.Minute, func() *resource.RetryError {
Expand Down
5 changes: 3 additions & 2 deletions aws/data_source_aws_acmpca_certificate_authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package aws
import (
"fmt"
"log"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/acmpca"
Expand Down Expand Up @@ -113,8 +114,8 @@ func dataSourceAwsAcmpcaCertificateAuthorityRead(d *schema.ResourceData, meta in
certificateAuthority := describeCertificateAuthorityOutput.CertificateAuthority

d.Set("arn", certificateAuthority.Arn)
d.Set("not_after", certificateAuthority.NotAfter)
d.Set("not_before", certificateAuthority.NotBefore)
d.Set("not_after", aws.TimeValue(certificateAuthority.NotAfter).Format(time.RFC3339))
d.Set("not_before", aws.TimeValue(certificateAuthority.NotBefore).Format(time.RFC3339))

if err := d.Set("revocation_configuration", flattenAcmpcaRevocationConfiguration(certificateAuthority.RevocationConfiguration)); err != nil {
return fmt.Errorf("error setting tags: %s", err)
Expand Down
29 changes: 29 additions & 0 deletions aws/data_source_aws_api_gateway_api_key.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package aws

import (
"fmt"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/apigateway"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
)

func dataSourceAwsApiGatewayApiKey() *schema.Resource {
Expand All @@ -18,11 +22,28 @@ func dataSourceAwsApiGatewayApiKey() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"description": {
Type: schema.TypeString,
Computed: true,
},
"created_date": {
Type: schema.TypeString,
Computed: true,
},
"last_updated_date": {
Type: schema.TypeString,
Computed: true,
},
"enabled": {
Type: schema.TypeBool,
Computed: true,
},
"value": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"tags": tagsSchemaComputed(),
},
}
}
Expand All @@ -41,5 +62,13 @@ func dataSourceAwsApiGatewayApiKeyRead(d *schema.ResourceData, meta interface{})
d.SetId(aws.StringValue(apiKey.Id))
d.Set("name", apiKey.Name)
d.Set("value", apiKey.Value)
d.Set("created_date", aws.TimeValue(apiKey.CreatedDate).Format(time.RFC3339))
d.Set("description", apiKey.Description)
d.Set("enabled", apiKey.Enabled)
d.Set("last_updated_date", aws.TimeValue(apiKey.LastUpdatedDate).Format(time.RFC3339))

if err := d.Set("tags", keyvaluetags.ApigatewayKeyValueTags(apiKey.Tags).IgnoreAws().Map()); err != nil {
return fmt.Errorf("error setting tags: %s", err)
}
return nil
}
5 changes: 5 additions & 0 deletions aws/data_source_aws_api_gateway_api_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ func TestAccDataSourceAwsApiGatewayApiKey(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName1, "id", dataSourceName1, "id"),
resource.TestCheckResourceAttrPair(resourceName1, "name", dataSourceName1, "name"),
resource.TestCheckResourceAttrPair(resourceName1, "value", dataSourceName1, "value"),
resource.TestCheckResourceAttrPair(resourceName1, "enabled", dataSourceName1, "enabled"),
resource.TestCheckResourceAttrPair(resourceName1, "description", dataSourceName1, "description"),
resource.TestCheckResourceAttrSet(dataSourceName1, "last_updated_date"),
resource.TestCheckResourceAttrSet(dataSourceName1, "created_date"),
resource.TestCheckResourceAttr(dataSourceName1, "tags.%", "0"),
),
},
},
Expand Down
20 changes: 10 additions & 10 deletions aws/data_source_aws_api_gateway_rest_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ func dataSourceAwsApiGatewayRestApiRead(d *schema.ResourceData, meta interface{}

d.SetId(*match.Id)

resp, err := conn.GetResources(&apigateway.GetResourcesInput{
resourceParams := &apigateway.GetResourcesInput{
RestApiId: aws.String(d.Id()),
})
if err != nil {
return err
}

for _, item := range resp.Items {
if *item.Path == "/" {
d.Set("root_resource_id", item.Id)
break
err = conn.GetResourcesPages(resourceParams, func(page *apigateway.GetResourcesOutput, lastPage bool) bool {
for _, item := range page.Items {
if *item.Path == "/" {
d.Set("root_resource_id", item.Id)
return false
}
}
}
return !lastPage
})

return nil
return err
}
27 changes: 27 additions & 0 deletions aws/data_source_aws_api_gateway_vpc_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/apigateway"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
)

func dataSourceAwsApiGatewayVpcLink() *schema.Resource {
Expand All @@ -23,6 +24,24 @@ func dataSourceAwsApiGatewayVpcLink() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"description": {
Type: schema.TypeString,
Computed: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
},
"status_message": {
Type: schema.TypeString,
Computed: true,
},
"target_arns": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"tags": tagsSchemaComputed(),
},
}
}
Expand Down Expand Up @@ -57,6 +76,14 @@ func dataSourceAwsApiGatewayVpcLinkRead(d *schema.ResourceData, meta interface{}

d.SetId(*match.Id)
d.Set("name", match.Name)
d.Set("status", match.Status)
d.Set("status_message", match.StatusMessage)
d.Set("description", match.Description)
d.Set("target_arns", flattenStringList(match.TargetArns))

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

return nil
}
Loading

0 comments on commit 30380f9

Please sign in to comment.