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

add support email address #548

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/cdktf/python/resources/cert_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ Optional:
- `province` (String) Distinguished name: `ST`
- `serial_number` (String) Distinguished name: `SERIALNUMBER`
- `street_address` (List of String) Distinguished name: `STREET`
- `email_address` (String) Email address: `emailAddress (x509 1.2.840.113549.1.9.1)`

<!-- cache-key: cdktf-0.20.1 input-f0b329ca4c0554d420316e3aa077babdcc26589666ed69b639e7ed93d15ac558 -->
1 change: 1 addition & 0 deletions docs/cdktf/python/resources/self_signed_cert.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Optional:
- `province` (String) Distinguished name: `ST`
- `serial_number` (String) Distinguished name: `SERIALNUMBER`
- `street_address` (List of String) Distinguished name: `STREET`
- `email_address` (String) Email address: `emailAddress (x509 1.2.840.113549.1.9.1)`

## Automatic Renewal

Expand Down
1 change: 1 addition & 0 deletions docs/resources/cert_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ Optional:
- `province` (String) Distinguished name: `ST`
- `serial_number` (String) Distinguished name: `SERIALNUMBER`
- `street_address` (List of String) Distinguished name: `STREET`
- `email_address` (String) Email address: `emailAddress (x509 1.2.840.113549.1.9.1)`
1 change: 1 addition & 0 deletions docs/resources/self_signed_cert.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Optional:
- `province` (String) Distinguished name: `ST`
- `serial_number` (String) Distinguished name: `SERIALNUMBER`
- `street_address` (List of String) Distinguished name: `STREET`
- `email_address` (String) Email address: `emailAddress (x509 1.2.840.113549.1.9.1)`

## Automatic Renewal

Expand Down
7 changes: 7 additions & 0 deletions internal/provider/common_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,5 +386,12 @@ func createSubjectDistinguishedNames(ctx context.Context, subject certificateSub
result.SerialNumber = subject.SerialNumber.ValueString()
}

if !subject.EmailAddress.IsNull() && !subject.EmailAddress.IsUnknown() {
result.ExtraNames = append(result.ExtraNames, pkix.AttributeTypeAndValue{
Type: []int{1, 2, 840, 113549, 1, 9, 1},
Value: subject.EmailAddress.ValueString(),
})
}

return result
}
1 change: 1 addition & 0 deletions internal/provider/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type certificateSubjectModel struct {
Country types.String `tfsdk:"country"`
PostalCode types.String `tfsdk:"postal_code"`
SerialNumber types.String `tfsdk:"serial_number"`
EmailAddress types.String `tfsdk:"email_address"`
}

type privateKeyResourceModel struct {
Expand Down
7 changes: 7 additions & 0 deletions internal/provider/resource_cert_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ func (r *certRequestResource) Schema(_ context.Context, req resource.SchemaReque
},
Description: "Distinguished name: `SERIALNUMBER`",
},
"email_address": schema.StringAttribute{
Optional: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "Email Address: `1.2.840.113549.1.9.1`",
},
},
},
MarkdownDescription: "The subject for which a certificate is being requested. " +
Expand Down