Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACM Certificates have validation method set to NONE #12075

Closed
nijave opened this issue Feb 18, 2020 · 3 comments · Fixed by #13513
Closed

ACM Certificates have validation method set to NONE #12075

nijave opened this issue Feb 18, 2020 · 3 comments · Fixed by #13513
Assignees
Labels
bug Addresses a defect in current functionality. service/acm Issues and PRs that pertain to the acm service.
Milestone

Comments

@nijave
Copy link
Contributor

nijave commented Feb 18, 2020

Need to add some details when I have time but it looks like aws_acm_certificate isn't correctly parsing the AWS response to determine the validation method

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

0.12.3

Affected Resource(s)

  • aws_acm_certificate

Terraform Configuration Files

TODO

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

Certificate response is parsed correctly

Actual Behavior

EMAIL validation isn't successfully parsed from the response

Steps to Reproduce

  1. terraform plan

Important Factoids

References

AWS response

{
    "Certificate": {
        "CertificateArn": "arn:aws:acm:us-east-1:1234:certificate/1234",
        "DomainName": "sub-domain.example.com",
        "SubjectAlternativeNames": [
            "sub-domain2.example.com"
        ],
        "DomainValidationOptions": [
            {
                "DomainName": "sub-domain.example.com",
                "ValidationDomain": "example.com",
                "ValidationStatus": "SUCCESS",
                "ValidationMethod": "EMAIL"
            }
        ],
        "Serial": "12:34:6e:24:29:ad:00:00:00:00:88:04:00:00:00:00",
        "Subject": "sub-domain.example.com",
        "Issuer": "Amazon",
        "CreatedAt": 1552662375.0,
        "IssuedAt": 1581825267.0,
        "Status": "ISSUED",
        "NotBefore": 1581811200.0,
        "NotAfter": 1615896000.0,
        "KeyAlgorithm": "RSA-2048",
        "SignatureAlgorithm": "SHA256WITHRSA",
        "InUseBy": [
            "arn:aws:elasticloadbalancing:us-east-1:1234:loadbalancer/app/my-lb/1234"
        ],
        "Type": "AMAZON_ISSUED",
        "RenewalSummary": {
            "RenewalStatus": "SUCCESS",
            "DomainValidationOptions": [
                {
                    "DomainName": "sub-domain.example.com",
                    "ValidationDomain": "example.com",
                    "ValidationStatus": "SUCCESS",
                    "ValidationMethod": "EMAIL"
                }
            ],
            "UpdatedAt": 1581827004.0
        },
        "KeyUsages": [
            {
                "Name": "DIGITAL_SIGNATURE"
            },
            {
                "Name": "KEY_ENCIPHERMENT"
            }
        ],
        "ExtendedKeyUsages": [
            {
                "Name": "TLS_WEB_SERVER_AUTHENTICATION",
                "OID": "1.3.6.1.5.5.7.3.1"
            },
            {
                "Name": "TLS_WEB_CLIENT_AUTHENTICATION",
                "OID": "1.3.6.1.5.5.7.3.2"
            }
        ],
        "RenewalEligibility": "ELIGIBLE",
        "Options": {
            "CertificateTransparencyLoggingPreference": "ENABLED"
        }
    }
}

aws_acm_certificate.go

		for _, o := range certificate.DomainValidationOptions {
			if o.ResourceRecord != nil {
				validationOption := map[string]interface{}{
					"domain_name":           *o.DomainName,
					"resource_record_name":  *o.ResourceRecord.Name,
					"resource_record_type":  *o.ResourceRecord.Type,
					"resource_record_value": *o.ResourceRecord.Value,
				}
				domainValidationResult = append(domainValidationResult, validationOption)
			} else if o.ValidationEmails != nil && len(o.ValidationEmails) > 0 {
				for _, validationEmail := range o.ValidationEmails {
					emailValidationResult = append(emailValidationResult, *validationEmail)
				}
			} else if o.ValidationStatus == nil || aws.StringValue(o.ValidationStatus) == acm.DomainStatusPendingValidation {
				log.Printf("[DEBUG] No validation options need to retry: %#v", o)
				return nil, nil, fmt.Errorf("No validation options need to retry: %#v", o)
			}
		}

It is looking for ValidationEmails and ResourceRecord keys but my response contains a ValidationMethod key that provides the correct information. Need to validate with AWS docs, as well

  • #0000
@ghost ghost added the service/acm Issues and PRs that pertain to the acm service. label Feb 18, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 18, 2020
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 27, 2020
@bflad bflad self-assigned this May 27, 2020
bflad added a commit that referenced this issue May 27, 2020
Reference: #3855
Reference: #6082
Reference: #8755
Reference: #12075
Reference: #13053

Notable changes:

```
ENHANCEMENTS:

* resource/aws_acm_certificate: Add `status` attribute

BUG FIXES:

* resource/aws_acm_certificate: Detect `AMAZON_ISSUED` type `validation_method` value directly from API response instead of custom logic
* resource/aws_acm_certificate: Increase deletion retries from 10 minutes to 20 minutes (better support API Gateway Custom Domain deletion)
```

Other changes:

- Documents `subject_alternative_names` argument removal procedures
- Improves potentially confusing error message during asynchronous ACM validation assignment

Output from acceptance testing:

```
--- PASS: TestAccAWSAcmCertificate_imported_IpAddress (36.64s)
--- PASS: TestAccAWSAcmCertificate_root_TrailingPeriod (37.74s)
--- PASS: TestAccAWSAcmCertificate_wildcard (38.86s)
--- PASS: TestAccAWSAcmCertificate_wildcardAndRootSan (39.08s)
--- PASS: TestAccAWSAcmCertificate_emailValidation (39.11s)
--- PASS: TestAccAWSAcmCertificate_dnsValidation (39.35s)
--- PASS: TestAccAWSAcmCertificate_rootAndWildcardSan (39.62s)
--- PASS: TestAccAWSAcmCertificate_disableCTLogging (41.62s)
--- PASS: TestAccAWSAcmCertificate_san_single (41.93s)
--- PASS: TestAccAWSAcmCertificate_san_TrailingPeriod (42.00s)
--- PASS: TestAccAWSAcmCertificate_san_multiple (42.05s)
--- PASS: TestAccAWSAcmCertificate_root (42.07s)
--- PASS: TestAccAWSAcmCertificate_privateCert (47.46s)
--- PASS: TestAccAWSAcmCertificate_imported_DomainName (54.51s)
--- PASS: TestAccAWSAcmCertificate_tags (85.67s)
```
bflad added a commit that referenced this issue Jun 4, 2020
…13513)

Reference: #3855
Reference: #6082
Reference: #8755
Reference: #12075
Reference: #13053

Notable changes:

```
ENHANCEMENTS:

* resource/aws_acm_certificate: Add `status` attribute

BUG FIXES:

* resource/aws_acm_certificate: Detect `AMAZON_ISSUED` type `validation_method` value directly from API response instead of custom logic
* resource/aws_acm_certificate: Increase deletion retries from 10 minutes to 20 minutes (better support API Gateway Custom Domain deletion)
```

Other changes:

- Documents `subject_alternative_names` argument removal procedures
- Improves potentially confusing error message during asynchronous ACM validation assignment

Output from acceptance testing:

```
--- PASS: TestAccAWSAcmCertificate_imported_IpAddress (36.64s)
--- PASS: TestAccAWSAcmCertificate_root_TrailingPeriod (37.74s)
--- PASS: TestAccAWSAcmCertificate_wildcard (38.86s)
--- PASS: TestAccAWSAcmCertificate_wildcardAndRootSan (39.08s)
--- PASS: TestAccAWSAcmCertificate_emailValidation (39.11s)
--- PASS: TestAccAWSAcmCertificate_dnsValidation (39.35s)
--- PASS: TestAccAWSAcmCertificate_rootAndWildcardSan (39.62s)
--- PASS: TestAccAWSAcmCertificate_disableCTLogging (41.62s)
--- PASS: TestAccAWSAcmCertificate_san_single (41.93s)
--- PASS: TestAccAWSAcmCertificate_san_TrailingPeriod (42.00s)
--- PASS: TestAccAWSAcmCertificate_san_multiple (42.05s)
--- PASS: TestAccAWSAcmCertificate_root (42.07s)
--- PASS: TestAccAWSAcmCertificate_privateCert (47.46s)
--- PASS: TestAccAWSAcmCertificate_imported_DomainName (54.51s)
--- PASS: TestAccAWSAcmCertificate_tags (85.67s)
```
@bflad bflad added this to the v2.65.0 milestone Jun 4, 2020
@bflad
Copy link
Contributor

bflad commented Jun 4, 2020

The resource has been updated to directly lookup the DomainValidationOptions ValidationMethod instead of guessing based on ResourceRecord or ValidationEmails. This will release with version 2.65.0 of the Terraform AWS Provider, likely later today. 👍

@ghost
Copy link

ghost commented Jun 5, 2020

This has been released in version 2.65.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Jul 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. 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!

@ghost ghost locked and limited conversation to collaborators Jul 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/acm Issues and PRs that pertain to the acm service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants