Comments (9)
You should use jsonencode for things like dkim records:
value = jsonencode("v=DKIM1;h=sha256;k=rsa;s=email;p=MIIBIjAN...")
from terraform-provider-hetznerdns.
@kimdre Sorry, I edited the question a lot after your comment. But in any case: I just tried jsconencode
, and it doesn't make a difference.
from terraform-provider-hetznerdns.
The splitting is normal for long records like dkim, as the length of a single string in TXT records is limited to 255 bytes. It's normal though and the only workaround for this is to replace your single string with the splitted one that terraform shows as the current value before performing actions.
from terraform-provider-hetznerdns.
A nice workaround to split recods automatically is described in a similiar issue related to route53 on aws: hashicorp/terraform-provider-aws#14941 (comment)
from terraform-provider-hetznerdns.
Thanks, here's what I came up with after some trial and error: #56
jsonencode
takes care of escaping the quotes, and the last ""
is to get the blank character at the end.
Do you see a nicer way?
from terraform-provider-hetznerdns.
I thought of the other workaround under my linked comment, which splits the string when needed (after every 255th char). However I have not tried it.
from terraform-provider-hetznerdns.
Oh, I've overlooked that. However, it's overescaping (\"\"
), so jsonencode
would probably be required as well.
Anyway, I've already spent too much time for this - if anybody finds a cleaner solution, feel free to update my example in README! :-)
from terraform-provider-hetznerdns.
I just tried it out with a combination of your example and the mentioned workaround with small changes:
This not only splits the string every 255th character but also adds \"
at the start and the space at the end just like hetzner wants it.
#DKIM record
locals {
dkim = "v=DKIM1;k=rsa;t=s;s=email;p=abc"
}
resource "hetznerdns_record" "example_com_dkim" {
zone_id = hetznerdns_zone.example_com.id
name = "dkim._domainkey"
type = "TXT"
value = join("\"", [
"",
replace(local.dkim, "/(.{255})/", "$1\" \""),
" "
])
}
from terraform-provider-hetznerdns.
Indeed, this works for me too. I added it as alternative way - since it isn't really simpler than the other way ;-)
from terraform-provider-hetznerdns.
Related Issues (20)
- Fake or real ALIAS record support HOT 3
- dot or no dot HOT 1
- How to handle SOA entries? HOT 2
- Suggestion: Provide constants for Hetzner nameservers HOT 2
- Suggestion: Support IDNs HOT 2
- Please support arm64 architecture HOT 2
- Issues working with wildcard DNS HOT 2
- Error: Error creating DNS record ...: Error creating record ...: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: ' HOT 18
- Cannot update to 1.2.0: Failed to query available provider packages HOT 5
- DNS record will not be destroyed, when DNS zone has the prevent_destroy flag HOT 1
- Example for handling SRV records HOT 1
- Suggestion: Hand over the project to https://github.com/hetznercloud GitHub organization HOT 5
- Add the ability to manage primary servers HOT 3
- Hitting rate limit (without hitting it) HOT 3
- Convert list of values to multiple records
- terraform apply randomly gets stuck with "Still creating" HOT 12
- add data source hetznerdns_records HOT 1
- How to increase timeouts & retries? HOT 1
- Submit provider gpg key to registry.opentofu.org HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-hetznerdns.